So, i'm making program that will multiply and adds matrices. I created class matrix with constructor:
class Matrix
{
private:
int row;
int column;
public:
int getRows()
{
return row;
}
int getColumns()
{
return column;
}
void print_matrix()
{
for(int i = 0; i < row; i++)
{
cout<<"\n";
for(int j = 0; j < column; j++)
cout<<matrix[i][j]<<"\t";
}
}
Matrix(int row, int column);
};
Matrix::Matrix(int row, int column)
{
this->row = row;
this->column = column;
int** matrix = new int*[row];
for(int i = 0; i < row; i++)
matrix[i] = new int[column];
for(int i = 0; i < row; i++)
for(int j = 0; j < column; j++)
matrix[i][j] = (i+j)*2*3/4;
for(int i = 0; i < row; i++)
delete[] matrix[i];
delete[] matrix;
}
at this point i dont know how to print my matrix, or work with him. In method "print_matrix" my compilator said that "'matrix was not declarated in this scope'".