Write a program to implement the following operations (the ones mentioned in comments) on Matrix. The main() function of the above program is as below:
#include<iostream>
#include<conio.h>
using namespace std;
class matrix{
int rows;
int cols;
int mat[3][3];
public:
void getdata();
void putdata();
};
void matrix::getdata()
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
cout<<"A["<<i<<"]["<<j<<"] : ";
cin>>mat[i][j];
}
}
}
void matrix::putdata()
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
cout<<" "<<mat[i][j];
}
cout<<endl;
}
}
int main()
{
matrix m;
m.getdata();
m.putdata();
return(0);
}
Comments
Leave a comment