Matrix
Matrix
public:
matrices()
{
rows = 0;
columns = 0;
matrix[rows][columns];
}
matrices(int r, int c)
{
rows = r;
columns = c;
matrix[rows][columns];
}
void Set_Data()
{
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < columns; j++)
{
cout << "Enter the elment of (" << i + 1 << "," << j + 1 << ")" <<
endl;
cin >> matrix[i][j];
}
}
}
void display()
{
cout << "----------Displaying the matrix----------" << endl;
for (int k = 0; k < rows; k++)
{
cout << "\t|\t";
for (int l = 0; l < columns; l++)
{
cout << matrix[k][l] << "\t";
}
cout << "|" << endl;
}
}
void addition(){
}
};
int main()
{
int r, c;
cout << "Enter the no.of rows:" << endl;
cin >> r;
cout << "Enter the no.of columns:" << endl;
cin >> c;
matrices m1(r, c);
m1.Set_Data();
m1.display();
return 0;
}