#include <cstdlib>
#include <iostream>
#include <iomanip>
using namespace std;
class Array{
public:
void input();
void output();
private:
int n,m,a[10][10];
};
void Array::input(){
cout<<"Masukkan banyak baris : ";cin>>n;
cout<<"Masukkan banyak kolom : ";cin>>m;
cout<<endl;
cout<<"Input Matriks A"<<endl;
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
cout<<"Data ke A["<<i<<"]"<<"["<<j<<"] : ";cin>>a[i][j];
}
}
}
void Array::output(){
cout<<"Matriks A"<<endl;
cout<<endl;
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++)
cout<<setw(5)<<a[i][j]<<" ";
cout<<endl;
}
cout<<endl;
cout<<"Transpose Matrik A"<<endl;
cout<<endl;
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++)
cout<<setw(5)<<a[j][i]<<" ";
cout<<endl;
}
}
int main(int argc, char *argv[])
{
Array x;
x.input();
x.output();
system("PAUSE");
return EXIT_SUCCESS;
}
Hasil Compile :
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar