0% found this document useful (0 votes)
26 views2 pages

Matrix

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views2 pages

Matrix

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include <iostream>

using namespace std;


class matrices
{
int rows;
int columns;
int matrix[10][10];

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;
}

You might also like