Laman

Jumat

Perkalian 2 Matriks valid

#include
#include
#include
#include

class matrix{
friend ostream& operator<>(istream&, matrix&);
public :
void input_matrix();
void perkalian_2matrix(const matrix&, const matrix&);
private:
int M[20][20];
int baris, kolom;
};
void matrix::input_matrix(){
int i,j;
for(i=0;i<<"Data ["<<(i+1)<<"] ["<<(j+1)<>M[i][j];
}
}
}
void matrix::perkalian_2matrix(const matrix& matrix1, const matrix& matrix2){
int i,j,k;
int barkol;

baris=matrix1.baris;
kolom=matrix2.kolom;
barkol=matrix1.kolom;
if(matrix1.kolom!=matrix2.baris){
cout<<"Tidak bisa menampilkan"<

for(i=0;i(istream& in, matrix& input){
cout<>input.baris;
cout<>input.kolom;
cout<<"Masukkan data matrix = ";
input.input_matrix();

return in;
}
ostream& operator<<(ostream& out, matrix& output){
int i,j;
for(i=0; i<<<<" ";
}
cout<<<"Masukkan Data Matrix ke-1"<>matrix1;
cout<<<"Masukkan Data Matrix ke-2"<>matrix2;
cout<<<"Hasil perkalian dua matrix"<<

Tidak ada komentar:

Posting Komentar