typedef std::vector<std::vector<double> > Matrix;
//with initialization
Matrix matrix1 = { {0.1,1.1,.2},
{.4,.5,.6},
{.8,.9,.10}
};
//just initiation (3x3)
Matrix matrix2(3, std::vector<double>(3) );
void matrixInput(int n, int m, int **arr)
{
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
cin >> arr[i][j];
}
}
}
void matrixDisplay(int n, int m, int **arr)
{
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
cout << arr[i][j] << " ";
}
cout << endl;
}
}
void matrix()
{
int n, m;
cout << "Enter matrix row and column: ";
cin >> n >> m;
int **arr;
arr = new int *[m];
for (int i = 0; i < m; i++)
arr[i] = new int[m];
matrixInput(n, m, arr);
cout << "
Displaying matrix:
";
matrixDisplay(n, m, arr);
}