#include <iostream.h>
#include <conio.h>
#include <iomanip.h>
int main ()
{
awal :
clrscr();
int x, y, a[3][3], b[3][3];
cout<<"PROGRAM PENJUMLAHAN MATRIKS"<<endl;
cout<<"--------------------------"<<endl;
cout<<"MATRIKS A"<<endl;
for(x=0;x<3;x++)
for(y=0;y<3;y++)
{
cout<<"Elemen ke - "<<x<<"."<<y<<" : "; cin>>a[x][y]; }}
for(x=0;x<3;x++)
{
for(y=0;y<3;y++)
{
cout<<setw(6)<<a[x][y];
}
cout<<endl; }
cout<<endl;
cout<<"MATRIKS B"<<endl;
for(x=0;x<3;x++)
for(y=0;y<3;y++)
{
cout<<"Elemen ke - "<<x<<"."<<y<<" : "; cin>>b[x][y]; }}
for(x=0;x<3;x++)
{
for(y=0;y<3;y++)
{
cout<<setw(6)<<b[x][y];
}
cout<<endl; }
cout<<endl;
cout<<"HASIL PENJUMLAHAN MATRIKS"<<endl;
for(x=0;x<3;x++)
{
for(y=0;y<3;y++)
{
cout<<setw(6)<<a[x][y]+b[x][y];
}
cout<<endl;
}
cout<<endl;
char q;
cout<<"ULANGI MATRIKS : (Y/N) ??" ;
cin>>q;
if(q=='Y')
goto awal;
else
if(q=='N')
goto akhir;
akhir :
cout<<"--------------------------"<<endl;
cout<<"rianovitam.blogspot.com";
getch();
return 0;
}
Nah hasil dari program tersebut ialah seperti ini,
Sekian dulu semoga bermanfaat amin
