#include<iostream.h>
#include<conio.h>
main()
{
int n1,n2,pil,total;
char lagi;
atas:
clrscr;
cout<<"Menu Program"<<endl;
cout<<"1.Tambah(+)"<<endl;
cout<<"2.Kurang(-)"<<endl;
cout<<"3.Kali(*)"<<endl;
cout<<"4.Bagi(/)"<<endl;
cout<<"Masukan Nilai Pertama = ";
cin>>n1;
cout<<"Masukan Nilai Kedua = ";
cin>>n2;
cout<<"Pilih Operator Aritmatik [1/4] = ";
cin>>pil;
if (pil==1)
{ total=n1+n2;}
else if(pil==2)
{ total=n1-n2; }
else if(pil==3)
{ total=n1*n2;}
else if (pil==4)
{ total=n1/n2; }
else
{
cout<<"Kode Menu yang anda masukan salah";
cout<<"Silahkan Coba Lagi !";
goto atas;
}
cout<<"Hasil Perhitungan = "<<total;
cout<<"\n";
cout<<"Mau Hitung Lagi ? [Y/N] ";
cin>>lagi;
if(lagi=='Y')
goto atas;
else
cout<<"Terimakasih";
}
Penampakan Output nya :
#include<conio.h>
main()
{
int n1,n2,pil,total;
char lagi;
atas:
clrscr;
cout<<"Menu Program"<<endl;
cout<<"1.Tambah(+)"<<endl;
cout<<"2.Kurang(-)"<<endl;
cout<<"3.Kali(*)"<<endl;
cout<<"4.Bagi(/)"<<endl;
cout<<"Masukan Nilai Pertama = ";
cin>>n1;
cout<<"Masukan Nilai Kedua = ";
cin>>n2;
cout<<"Pilih Operator Aritmatik [1/4] = ";
cin>>pil;
if (pil==1)
{ total=n1+n2;}
else if(pil==2)
{ total=n1-n2; }
else if(pil==3)
{ total=n1*n2;}
else if (pil==4)
{ total=n1/n2; }
else
{
cout<<"Kode Menu yang anda masukan salah";
cout<<"Silahkan Coba Lagi !";
goto atas;
}
cout<<"Hasil Perhitungan = "<<total;
cout<<"\n";
cout<<"Mau Hitung Lagi ? [Y/N] ";
cin>>lagi;
if(lagi=='Y')
goto atas;
else
cout<<"Terimakasih";
}
Penampakan Output nya :