Senin, 29 November 2010

Program Menu Pada C++

Coding :

#include
#include
int m[5][5],a,b,c,d;
int pil,UTS,UAS;
float final;
char nama[30],npm[9],kelas[5];
void main()
{

menu:
cout<<"+++++ menu +++++"<
cout<<" 1.biodata"<
cout<<" 2.kondisi"<
cout<<" 3.matrik"<
cout<<" 4.exit"<
cout<<"++++++++++++++++"<
cout<<"masukkan pilihan : ";cin>>pil;
cout<
switch(pil)
{
case 1:
cout<<"nama saya: ";cin>>nama;
cout<<"npm saya: ";cin>>npm;
cout<<"kelas saya: ";cin>>kelas;
cout<
cout<<"nama saya:"<<
cout<<"npm saya:"<<
cout<<"kelas saya:"<<
cout<
goto menu;
case 2:
cout<<"nilai UTS: ";cin>>UTS;
cout<<"nilai UAS: ";cin>>UAS;
final= (UTS+UAS)/2;
if (final >=60)
cout<<"ANDA LULUS"<
else
cout<<"ANDA TAK LULUS"<
cout<
goto menu;
case 3:
cout<<"masukan kolom :";cin>>a;
cout<<"masukan baris :";cin>>b;
int m[10][10];
for (c=1;c<=a;c++)
{
for (d=1;d<=b;d++)
{
cout<<"\n input ["<<<"]["<<<>>m[c-1][d-1];}}
for (c=1;c<=a;c++)
{
for (d=1;d<=b;d++)
{
cout<<<">
}
cout<<"\n";
}
cout<<"\n";
for (c=1;c<=a;c++)
{
for (d=1;d<=b;d++)
{
cout<<<">
}
cout<<"\n";
}
case 4:
cout<<"selesai";
}
}



Output:




0 komentar:

Posting Komentar