Q 12. WAP To Declare A Class Transpose Which Transpose The Elements of Entered Matrix
Q 12. WAP To Declare A Class Transpose Which Transpose The Elements of Entered Matrix
#include<iostream.h>
#include<conio.h>
class transpose
{
public:
void getdata();
};
void transpose::getdata()
{
int x[10][10],c,r,i,j;
cout<<"Enter rows limit : ";
cin>>r;
cout<<"Enter column limit : ";
cin>>c;
cout<<"Enter matrix : \n";
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
cin>>x[i][j];
}
}
cout<<"Entered matrix is :\n";
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
cout<<x[i][j]<<" ";
}
cout<<endl;
}
cout<<"After transpose matrix is :\n";
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
cout<<x[j][i]<<" ";
}
cout<<endl;
}
}
void main()
{
clrscr();
transpose t;
t.getdata();
getch();
}
OUTPUT 12 :