Contoh Program C++ Array Dimensi 2 Matriks Transpose
Ini Contoh Programnya :
#include<iostream.h>
int main ()
{
cout<<"---------------------------------------------------\n";
cout<<" Nama : Ikbal Mahdi \n";
cout<<" NPM : 0651 13 052 \n";
cout<<" Tugas Matriks[3][3] Transpose \n";
cout<<"---------------------------------------------------\n";
cout<<endl;
int transpose[3][3];
int baris,kolom;
for(baris=0;baris<3;baris++)
{
for(kolom=0;kolom<3;kolom++)
{
cout<<"Masukan Angka ["<<baris<<"] ["<<kolom<<"] = ";
cin>>transpose[baris][kolom];
}
cout<<endl;
}
cout<<"Matriks yang belum di Transpose \n";
cout<<"----------------------------------\n";
for(baris=0;baris<3;baris++)
{
for(kolom=0;kolom<3;kolom++)
{
cout<<transpose[baris][kolom]<<" ";
}
cout<<endl;
}
cout<<"Matriks yang sudah di Transpose \n";
cout<<"----------------------------------\n";
for(kolom=0;kolom<3;kolom++)
{
for(baris=0;baris<3;baris++)
cout<<transpose[baris][kolom]<<" ";
cout<<endl;
}
}
Ini Contoh Outputnya :
Comments
Post a Comment