Ketemu lagi nich....
Nich da contoh program matriks lagi..
kali ini kita belajar membuat "Tranpose Matriks"
Ini programnya :
//Tranpose Matriks
#include <conio.h>
#include <iostream.h>
void main(){
int matrika[3][3];
int i,j;
for(i=0;i<=2;i++){
for(j=0;j<=2;j++){
cout<<"["<<i<<"]["<<j<<"] : ";
cin>>matrika[i][j];
}
}
cout<<endl;
cout<<endl;
cout<<"Hasil Matrik"<<endl;
for(i=0;i<=2;i++){
for(j=0;j<=2;j++){
cout<<matrika[i][j]<<" ";
}
cout<<endl;
}
cout<<"Diagonal Matrik A adalah : "<<matrika[0][0]<<" , "<<matrika[1][1]<<" , "<<matrika[2][2]<<endl;
cout<<endl;
cout<<endl;
cout<<"Transpose Matrik"<<endl;
for(i=0;i<=2;i++){
for(j=0;j<=2;j++){
cout<<matrika[j][i]<<" ";
}
cout<<endl;
}
getch();
}
Ingat komentar...
Dtunggu pertanyaannya yach...
Posting Komentar