so i need some help. I'm trying to create a matrix that will do all these functions.. but im not so sure what im doing wrong since im an inexperienced at c++. Anyone?
Gratzi!

#include <math.h>
#include <iostream>
#include <string>

//#include <matrix.h>
using namespace std;

#define MAXNUM 9


class Matrix
{
    private:
    int **mat_array; // data structure for a dynamic matrix
    int rows;
    int cols;
    //static int ** create(int, int);

    public:
	void *create(int nRows, int nCols) // constructor
    {
        rows = nRows;
        cols = nCols;
        mat_array = create(rows, cols);
		return mat_array;
    }
    // lots more public functions and operators

	~Matrix(){}; // destructor


    void operator+ (Matrix other) // operation for adding the values of two different matrices
    {
        Matrix *ADDversity(other.rows, other.cols)
		{
				int ADDversity[500];
				int i, j;
				for (i=0; i<rows; i++)
				{
					for (j=0; j<cols; j++)
					{
						ADDversity[i][j] = this.mat_array[i][j] + other.mat_array[i][j];
					}
				}
            return ADDversity;
    }
	}
    Matrix operator- (Matrix other) //operation for subtracting the values of two different matrices
    {
        Matrix other (other.rows, other.cols);
            int i, j;
            for (i=0; i<rows; i++)
            {
                for(j=0; j<cols; j++)
                {
                    SUBmarine[i][j] = this.mat_array[i][j] - other.mat_array[i][j];
                }
            }
            return SUBmarine;
    }

    /*Matrix operator* (Matrix other)
    {
        Matrix MULT (other->rows, other->cols);
        int i, j;
        
    }*/

	void *Scale_by(int mult,) // function for scaling all values of a matrix by selected int value
    {
            int i, j;
            for (i=0; i<rows; i++)
            {
                for(j=0; j<cols; j++)
                {
                    SCALastic[i][j] = ((this->mat_array[i][j]) * mult);
                }
            }
            return SCALastic;
    }


    Matrix Transpose_to(int cols, int rows) // function for transposing a selected matrix
    {
        int transcol = rows;
        int transrow = cols;

		TRANSistor (int transcols, int transrows);
		 {
			int i, j;
            for (i=0; i < tempcols; i++)
            {
                for(j=0; j < temprows; j++)
                {
                     
                    TRANSistor[j][i] = (this.mat_array[i][j]);
                    
                }
            }
		 return TRANSistor;
    }

    static int **create(int nrows, int ncols)
    {   // dynamically create and return a nrowsXncols
        // matrix with elements initialized to random #s
        int **values;
        values = new int *[nrows];
        for(int i=0; i < nrows; i++)
		{   *(values + i) = new int[ncols];
		  for(int i=0; i < nrows; i++)
            for(int j=0; j < ncols; j++)
            {
                values[i][j] = rand() % MAXNUM +1;
			}}

        return values;
    }

    void Matrix :: free_memory()
    {
		if( *mat_array != NULL)
        {
            for(int i = 0; i < rows; i++)
            {
                delete *mat_array[i][0];
				 
            }
           
        }
        rows = 0;
        cols = 0;
        mat_array = NULL;

    }

	};


int main(void)
{
    cout <<

Neither are we since you didn't explain your problem.

void *create(int nRows, int nCols) // constructor

Not. At least not by the routine connotation of the word constructor used in the context of C++.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.