Blog Kumpulan Tugas

Jumat, 17 Juni 2016

Metrik Transpose

#include <iostream>

using namespace std;

void masuk(int mat[2][2], int baris, int kolom){
for(int i=0;i<baris;i++){
for(int j=0;j<kolom;j++){
cout<<"Masukkan nilai ["<<i<<"]["<<j<<"] : ";cin>>mat[i][j];
}
}
}

void transpose(int mat[2][2], int baris, int kolom){
for(int i=0;i<baris;i++){
for(int j=0;j<kolom;j++){
cout<<" "<<mat[j][i]<<" ";
}
cout<<endl;
}
}

void tampil(int mat[2][2], int baris, int kolom){
for(int i=0;i<baris;i++){
for(int j=0;j<kolom;j++){
cout<<" "<<mat[i][j]<<" ";
}
cout<<endl;
}
}

main(){

int mat[2][2];

masuk(mat, 2, 2);
cout<<endl;
tampil(mat, 2, 2);
cout<<endl<<endl<<"Transpose diatas adalah : "<<endl;
transpose(mat, 2,2);

return 0;
}
Share:

0 komentar:

Posting Komentar

Diberdayakan oleh Blogger.

Blog Archive