Senin, 14 Mei 2012

Program C++ Array di dalam Menu



#include
#include
void main()
{
int pil,i,j;
int ax[2][2],bx[2][2];
ulang:
clrscr();
cout<<"PLEASE CHOOSE YOUR OPTION"<< endl; cout<<"-------------------------"<< endl; cout<<"1. Input Matrix A"<< endl; cout<<"2. Input Matrix B"<< endl; cout<<"3. Tampilan Matrix A"<< endl; cout<<"4. Tampilan Matrix B"<< endl; cout<<"5. Penjumlahan Matrix A"<< endl; cout<<"6. Penjumlahan Matrix B"<< endl; cout<<"7. EXIT!"<< endl; cout<<"Input Option:"; cin>>pil;
switch(pil)
{
case 1:
clrscr();
cout<<"Matrix A dengan Ordo 2x2"<< endl; cout<<"~~~~~~~~~~~~~~~~~~~~~~~~"<< endl; for(i=0; i<2; i++) { for(j=0; j<2; j++) { cout<<"Elemen["<<<"]["<<<"]:";< font=""><<"]["<<<"]:";<>
cin>> ax[i][j];
}
}
getch();
goto ulang;
case 2:
clrscr();
cout<<"Matrix B dengan Ordo 2x2"<< endl; cout<<"~~~~~~~~~~~~~~~~~~~~~~~~"<< endl; for(i=0; i<2; i++) { for(j=0; j<2; j++) { cout<<"Elemen["<<<"]["<<<"]:";< font=""><<"]["<<<"]:";<>
cin>> bx[i][j];
}
}
getch();
goto ulang;
case 3:
clrscr();
cout<<"Matrix A:"<< font=""><>
cout<<"========="<< font=""><>
for(i=0; i<2; i++) { for(j=0; j<2; j++) { cout<< ax[i][j]<<" "; } cout<< font=""><>
}
getch();
goto ulang;
case 4:
clrscr();
cout<<"Matrix B:"<< font=""><>
cout<<"========="<< font=""><>
for(i=0; i<2; i++) { for(j=0; j<2; j++) { cout<< bx[i][j]<<" "; } cout<< font=""><>
}
getch();
goto ulang;
case 5:
clrscr();
cout<<"Penjumlahan Matrix A+B\n"; cout<<"++++++++++++++++++++++\n"; for(i=0;i<2;i++) { for(j=0;j<2;j++) { cout<<" "<<<" ";<="" font=""><<">
}
cout<< font=""><>
}
getch();
goto ulang;
case 6:
clrscr();
cout<<"Pengurangan Matrix A-B\n"; cout<<"++++++++++++++++++++++\n"; for(i=0;i<2;i++) { for(j=0;j<2;j++) { cout<<" "<<<" ";<="" font=""><<">
}
cout<< font=""><>
}
getch();
goto ulang;
case 7:
clrscr();
cout<<"EXIT. Thank You!";
break;
default:
cout<<"Sst, No option!";
getch();
goto ulang;
}
getch();
}

Tidak ada komentar:

Posting Komentar