Rabu, 06 Maret 2013

PENGGURANGAN METRIK



#include <iostream.h>
#include <conio.h>
void main()
{
int matrix[20][30], matrix2[2][3],jumlah[2][3];
inth,k;
gotoxy(4,2);
cout<<"Pengurangan Matrix\n";
gotoxy(3,3);
cout<<"=+=+=+=+=+=+=+=+=+=+\n";
cout<<"matrix A :";
cout<<endl;
for (h=1;h<=2;h++)
    {
for(k=1;k<=3;k++)
       {
cout<<"masukkannilaibaris "<<h<<" kolom "<<k<<" : ";
cin>>matrix[h][k];
       }
    }
cout<<"\nMatrix B :\n";
for (h=1;h<=2;h++)
    {
for(k=1;k<=3;k++)
       {
cout<<"masukkannilaibaris "<<h<<" kolom "<<k<<" : ";
cin>>matrix2[h][k];
       }
    }
for (h=1;h<=2;h++)
    {
for(k=1;k<=3;k++)
       {
jumlah[h][k]=matrix[h][k] - matrix2[h][k];
       }
    }
cout<<endl;
gotoxy(1,20);
cout<<"\C = ";
for(h=1;h<=2;h++)
 {
for(k=1;k<=3;k++)
  {
gotoxy(3+4*k,17+2*h);
cout<<matrix[h][k];
  }
 }
gotoxy(17,20);
cout<<" - ";
for(h=1;h<=2;h++)
 {
for(k=1;k<=3;k++)
  {
gotoxy(18+4*k,17+2*h);
cout<<matrix2[h][k];
  }
 }
gotoxy(32,20);
cout<<" = ";
for(h=1;h<=2;h++)
 {
for(k=1;k<=3;k++)
  {
gotoxy(33+4*k,17+2*h);
cout<<jumlah[h][k];
  }
 }
getch();
}

Tidak ada komentar:

Posting Komentar