Laman

Jumat

Contoh Matrix transpose

#include
#include
#include
#include
class matriks{
friend istream& operator>>(istream&, matriks&);
friend ostream& operator<<(ostream&, matriks&);
public:
void baca_matriks();
matriks& transpose(const matriks&);
private:
int baris, kolom;
int A[10][10];
};
void matriks::baca_matriks(){
int i,j;
for(i=0; i<<"Data["<<<"],["<<>A[i][j];
}
}
matriks& matriks::transpose(const matriks& matrik){
int i,j;
baris=matrik.kolom;
kolom=matrik.baris;
for(i=0;i(istream& in, matriks& A){
cout<>A.baris;
cout<>A.kolom;
cout<<"Masukkan data matriks\n";
A.baca_matriks();
return in;
}
ostream& operator<<(ostream& out, matriks& A){
int i,j;
for(i=0;i<<<<" ";
cout <<>matrik;
cout<<"Data Matrik :\n"; cout <<<"Hasil Transpose : \n";
T.transpose(matrik);
cout << T;
getch();
return 0;
}

Tidak ada komentar:

Posting Komentar