Membuat program menu dengan C++

Berikut ini coding membuat program MENU pada C++ 

#include<iostream.h>

#include<conio.h>

int main()

{

int menu,a,b,c,d;

menu:

clrscr();

cout<<“\n”;

cout<<” ============================\n”;

cout<<”                      MENU PILIHAN                          \n”;

cout<<“=============================\n”;

cout<<“\n”;

cout<<“[1] Pertambahan & Pengurangan\n”;

cout<<“[2] Continue\n”;

cout<<“[3] Operator conditional\n”;

cout<<“\n”;

cout<<“Masukkan Pilihan anda :”;

cin>>menu;

switch(menu)

{

case 1:

clrscr();

cout<<” ============================\n”;

cout<<”    PENAMBAHAN & PENGURANGAN          \n”;

cout<<“=============================\n”;

cout<<“\n”;

cout<<“Masukkan nilai a = “;

cin>>a;

cout<<“Masukkan nlai b = “;

cin>>b;

c=a+b;

cout<<” ============================\n”;

cout<<“\n”;

cout<<“a + b =”;

cout<< c <<endl;

cout<<“a – b  =”;

d=a-b;

cout<<d<<endl;

getch();

goto menu;

}

case 2:

clrscr();

cout<<” ============================\n”;

cout<<”                           CONTINUE                             \n”;

cout<<“=============================\n”;

cout<<“\n”;

for(int n=1;n<11;n++)

{

if (n==1)

continue;

cout<<n<<“->”;

}

cout<<” ====> Kami Angkatan 2010″;

getch();

goto menu;

}

default:

cout<<“ATTENTION, YOU ARE WRONG”;

getch();

goto menu;

case 3:

clrscr();

cout<<” ============================\n”;

cout<<”            OPERATOR CONDITIONAL                  \n”;

cout<<“=============================\n”;

cout<<“\n”;

COUT<<“\n masukkan nilai anda =”;

cout<<“\n”;

cout<<“=============================\n”;

cout<<“Kondisi Operator\n”;

cout<<“\n”;

cout<<“\n masukkan nilai anda =”;

cin>>x;

cout<<“\n”;

cout<<(a>=30?”Selamat anda berhasil”: “maaf anda belum berhasil”);

getch();

goto menu;

}

}

}

Maka tampilan menunya sebagai berikut :

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: