//procedur perkalian matrik
void perkalian(){
int i,j,k,x,y,z;
float A[10][10],B[10][10],C[10][10];
cout<<"======================================\n";
cout<<"= Program Perkalian Matrik =\n";
cout<<"======================================\n";
cout<<"=Masuakan Ordo Matrik A (max 10x10 !\n";
cout<<"=Baris matrik I :";cin>>x;
cout<<"=Kolom matrik I :";cin>>y;
cout<<"=Masuakan Ordo Matrik B (max 10x10) !\n";
cout<<"=Baris matrik II :"<
cout<<"======================================\n";
if ( (x>10) || (y>10) || (z>10) ){
gotoxy(20,12);cout<<"Masukan Angka di Bawah 10 !\n";
}
else
{
for (i=1;i<=x;i++){
for (j=1;j<=y;j++){
cout<<"=Elemen Matrik A ["<>A[i][j];
}
}
cout<<"======================================\n";
for (i=1; i<=y; i++){
for (j=1; j<=z; j++){
cout<<"=Elemen Matrik B ["<>B[i][j];
}
}
}
cout<<"======================================\n";
for (i=1; i<=x; i++){
for (j=1; j<=z; j++){
C[i][j]=0;
for (k=1; k<=y; k++){
C[i][j]=C[i][j]+(A[i][k]*B[k][j]);
}
}
}
for (i=1; i<=x; i++){
for (j=1; j<=z; j++){
cout<<"=Elemen Matrik C ["<
cout<<"\n";
}
}
cout<<"\n======================================";
}
Minggu, 17 Januari 2010
Procedure Perkalian Matriks di C++
Minggu, Januari 17, 2010
Galiarta
No comments
0 comments:
Posting Komentar