Friday, May 21, 2010

write a program to reverse or transpose the matrix

//Author Subhasis Nayak(MCA,BBA,G-TECH)
//date:-20-05-2010
/*TRANSPOSe THE MATRIX  */
/*progrtamming language C++ */
#include
#include
int main(){
int i,j;
int arFirst[3][3];
int arSecon[3][3];
//Taking value for matrix
cout<<"Enter the value for Matrix\n";
for(i=0;i<3;i++){
    for(j=0;j<3;j++){
        cin>>arFirst[i][j];
        }
    }
//Dispaying the matrix
cout<<"Enter the value for Matrix\n";
for(i=0;i<3;i++){
    for(j=0;j<3;j++){
        cout<<<"\t";
        }
    cout<
    }

//transposing the matrix and passing to another matrix
cout<<"Transposed Matrix is\n";
for(i=0;i<3;i++){
    for(j=0;j<3;j++){
        arSecon[i][j] = arFirst[j][i];
       
        }
   
    }
for(i=0;i<3;i++){
    for(j=0;j<3;j++){
        cout<<<"\t";
       
        }
    cout<
    }

getch();
clrscr();
return 0;
}

No comments:

Post a Comment