class InitMatrix{
private:
int M, N;
int** matrix;
public:
InitMatrix(int n, int m){
N = m;
M = m;
matrix = new int*[N];
for (int i = 0; i < N; i++){
matrix[i] = new int[M];
}
}
~InitMatrix();
//Get Item
void getItem() {
int i;
int j;
cout << "i = ";
cin >> i;
cout << "j = ";
cin >> j;
if (i >= N || j >= M)
cout << "ERROR INPUT" << endl;
else
cout << "matrix[" << i << "][" << j << "] = " << matrix[i][j] << endl;
}
//Change item in matrix
void setItem() {
int i;
int j;
cout << "i = ";
cin >> i;
cout << "j = ";
cin >> j;
if (i >= N || j >= M)
cout << "ERROR INPUT" << endl;
else
cout << "matrix[" << i << "][" << j << "] = ";
cin >> matrix[i][j];
}
};
class Matrix{
private:
InitMatrix * matrix;
public:
//Our method for matrix
};