Professional Documents
Culture Documents
Kelas
: S1.SI-3K
Nama :
1. Hermawan M. Wijaya
(09.12.4075)
(09.12.4053)
(09.12.3979)
4. Furqon Marzuki
(09.12.4024)
matrik_jumlah A,B,C;
int x,y;
int menu;
char ulang;
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
cout<<"
TUGAS STRUKTUR DATA\n";
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
do
{
menu:
cout<<"\n-----------------------------------";
cout<<"\n Penjumlahan Matrik 2x2 ";
cout<<"\nPilih menu yang disediakan (1/2/3): ";
cout<<"\n1. Input";
cout<<"\n2. Edit";
cout<<"\n-----------------------------------";
cout<<"\nMenu yang Anda pilih = ";cin>>menu;
if (menu==1){
cout<<"\nMenu Input\n";goto input;}
if (menu==2){
cout<<"\nMenu Edit\n";goto edit;}
//A (jumlah)
input:
cout<<"\nMasukkan data-data pertama\n\n";
for (x=0;x<2;x++)
{ for (y=0;y<2;y++)
{
cout<<"A["<<x<<"]["<<y<<"]= ";cin>>A[x][y];
}
}
//B
cout<<"\nMasukkan data-data kedua\n\n";
for (x=0;x<2;x++)
{ for (y=0;y<2;y++)
{
cout<<"B["<<x<<"]["<<y<<"]= ";cin>>B[x][y];
}
ARRAY 2 DIMENSI
}
//C
cout<<"\nHasil Penjumlahan\n\n";
for (x=0;x<2;x++)
{ for (y=0;y<2;y++)
{
C[x][y]=A[x][y]+B[x][y];
}
} cout<<endl;
for (x=0;x<2;x++)
{ for (y=0;y<2;y++)
{
cout<<"C["<<x<<"]["<<y<<"]= "<<C[x][y]<<endl;
}
}
cout<<"\nApakah Anda akan memilih menu lagi ? ; (Y/N)";cin>>ulang;
clrscr();
if (ulang=='Y'||ulang=='y')
goto menu;
else
cout<<"\nTerima Kasih sudah menggunakan program kami ^o^";
}
while (ulang=='Y'||ulang=='y');
//edit
do
{
edit:
cout<<"\nHasil Data yang lama\n";
for (x=0;x<2;x++)
{ for (y=0;y<2;y++)
{cout<<" "<<C[x][y]; } }
cout<<"\n\nData yang baru\n";
cout<<"\nMasukkan data-data pertama\n\n";
for (x=0;x<2;x++)
{ for (y=0;y<2;y++)
{
cout<<"A["<<x<<"]["<<y<<"]= ";cin>>A[x][y];
}
}
//B
cout<<"\nMasukkan data-data kedua\n\n";
for (x=0;x<2;x++)
{ for (y=0;y<2;y++)
{
cout<<"B["<<x<<"]["<<y<<"]= ";cin>>B[x][y];
}
}
ARRAY 2 DIMENSI
//C
cout<<"\nHasil Penjumlahan Data Baru\n\n";
for (x=0;x<2;x++)
{ for (y=0;y<2;y++)
{
C[x][y]=A[x][y]+B[x][y];
}
} cout<<endl;
for (x=0;x<2;x++)
{ for (y=0;y<2;y++)
{
cout<<"C["<<x<<"]["<<y<<"]= "<<C[x][y]<<endl;
}
}
cout<<"\nApakah Anda akan memilih menu lagi ? ; (Y/N)";cin>>ulang;
clrscr();
if (ulang=='Y'||ulang=='y')
goto menu;
else
cout<<"\nTerima Kasih sudah menggunakan program kami ^o^";
}
while (ulang=='Y'||ulang=='y');
getch();
}
ScreenShoot :
ARRAY 2 DIMENSI
ARRAY 2 DIMENSI