Program C++ Menghitung 2 Matrik A dan B Menggunakan Array

 Program C++ Menghitung 2 Matrik A dan B Menggunakan Array

#include
#include

void main () {
typedef int matrik22[100][100];

matrik22 A,B,C ;
int nb1,nk1b2 , nk2 ,k,j,i;
cout<<"BERAPA BARIS ARRAY A =";cin>>nb1;
cout<<"BERAPA KOLOM ARRAY A DAN BARIS ARRAY B =";cin>>nk1b2;
cout<<"BERAPA KOLOM ARRAY B =";cin>>nk2;


//A
    for(i=0;i  { for(j=0;j  {
    cout<<"Matrik A["<    cin>>A[i][j];
  }
  }
cout<
//B
    for(i=0;i  { for(j=0;j  {
    cout<<"Matrik B["<    cin>>B[i][j];
  }
  }

//perkalian array A dan B
    for(i=0;i  { for(j=0;j
  {
    C[i][j]=0;
 for ( k=0;k{
C[i][j]+=A[i][k]*B[k][j];
}
  }
  }
//menampilkan hasil pengalian matrik A dan B
cout<<"\nHasil Perkalian Matrik A dan B \n";
for (j=0;j{ for(i=0;i  {
    cout<<"["<  }
}

 getch ();
}
Share this article :
 

Poskan Komentar

 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. Catatanku - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger