#include <iostream> using namespace std; int main() { int i,j,baris, kolom, temp, m1[10][10],m2[10][10]; do { cout<<"Jumlah baris = "; cin>>baris; cout<<"Jumlah kolom = "; cin>>kolom; } while((baris>10)||(kolom>10)); cout<<"\nMatrix A" <<endl; for(i=0;i<baris;i++){ for(j=0;j<kolom;j++) { cout<<"Data ["<<i<<","<<j<<"] = "; cin>>m1[i][j]; }} for(i=0;i<baris;i++){ for(j=0;j<kolom;j++) { cout<<m1[i][j]<<" "; } cout<<endl; } cout<<"\nTranspose Matrix a" <<endl; temp=baris; baris=kolom; kolom=temp; for(i=0;i<baris;i++){ for(j=0;j<kolom;j++) { cout<<m1[j][i]<<" "; } cout<<endl; } return 0; }
Mentranspose matriks dengan C++
Berikut contoh program mentranspose matriks dengan menggunakan Dev-C++
0 comments:
Post a Comment