PROGRAM
#include<iostream.h>
#include<conio.h>
void main()
{
long int
a,b,c,pil;
char r;
do
{
cout<<" KALKULATOR
SEDERHANA"<<endl;
cout<<endl;
cout<<"Masukkan angka
pertama/pembilang : ";cin>>a;
cout<<"Masukkan angka kedua/penyebut : ";cin>>b;cout<<endl;
cout<<"Perintah yang akan
jalankan"<<endl;
cout<<"1. Tambah
(+)"<<endl;
cout<<"2. Kurang
(-)"<<endl;
cout<<"3. Bagi (:)"<<endl;
cout<<"4. Kali (*)"<<endl;
cin>>pil;
{
if(pil==1)
{
c=a+b;
cout<< a<<endl;
cout<< b;
cout<<"____+"<<endl;
cout<< c;
}
else
if(pil==2)
{
c=a-b;
cout<< a<<endl;
cout<< b;
cout<<"____-"<<endl;
cout<< c;
}
else
if(pil==3)
{
c=a/b;
cout<< a<<endl;
cout<< b;
cout<<"____:"<<endl;
cout<< c;
}
else
if(pil==4)
{
c=a*b;
cout<< a<<endl;
cout<< b;
cout<<"____*"<<endl;
cout<< c;
}
}
cout<<endl;
cout<<" Apakah anda ingin mengulang
program ini y/t ???"<<endl;
cin>>r;
}
while(r=='y');
cout<<"========================================================================"<<endl;
cout<<"= Sampai Jumpa
="<<endl;
cout<<"========================================================================"<<endl;
}
Tidak ada komentar:
Posting Komentar