Wednesday, January 22, 2014

Perhitungan Matriks ( Tugas 8 )



#include<iostream>
#include<conio.h>
#include<stdlib.h>
using namespace std;
int main()
{
    int a [15][15];
    int b [15][15];
    int jml [15][15];
    int y,z;

cout<<"\t\t\t Program Perkalian Matriks "<<endl;
cout<<"********************************************************************************"<<endl;
    for(y=1; y<=2;y++)
    {
    for(z=1;z<=2;z++)
    {
    cout<<" Masukan angka matriks F baris " <<y<< " kolom " <<z<< "=";
    cin>>a[y] [z];
}
cout<<endl;
}
cout<<endl<<endl;
for(y=1;y<=2;y++)
{
for(z=1;z<=2;z++)
{
cout<<" Masukan angka pada matriks H baris " <<y<< " kolom " <<z<< "=";
cin>>b[y] [z];
}
cout<<endl;
}
system("cls");
cout<<"\n Matriks F"<<endl;
for(y=1;y<=2;y++)
{
for(z=1;z<=2;z++)
{
cout<<a[y] [z]<<" ";
}
cout<<endl;
}
cout<<"\n Matriks H"<<endl;
for(y=1;y<=2;y++)
{
for(z=1;z<=2;z++)
{
cout<<b[y] [z]<<" ";
}
cout<<endl;
}
  cout<<" *************************************************************************"<<endl;
  cout<<" Hasil Perkalian Matriks "<<endl;
  cout<< "\nMatriks F * Matriks H : "<<endl;
            for(y=1; y<=2; y++)
            {
                for(z=1; z<=2; z++)
                {
                    jml[y][z]=a[y][z]*b[y][z];
                    cout<<"\t"<<jml[y] [z];
                }
                cout<<endl;
                          }

  getch();
}

Hasil Akhirnya :

 

No comments:

Post a Comment