#include <iostream>
#include <conio.h>
char opt;
int a,b;
float jum,kur,kal,bag;
main(){
cout<<" **KALKULATOR** "<<endl;
cout<<"\nSeptian Triastono";
cout<<"\n STMIK AMIKOM YOGYAKARTA";
cout<<"================================="<<endl;
cout<<"masukkan angka pertama=";cin>>a;
cout<<"masukkan angka kedua=";cin>>b;
cout<<"================================="<<endl;
cout<<"\n1.penjumlahan";
cout<<"\n2.pengurangan";
cout<<"\n3.perkalian";
cout<<"\n4.pembagian";<<endl;
cout<<"================================="<<endl;
jum=a+b;
kur=a-b;
kal=a*b;
bag=a/b;
cout<<"masukkan operator(1/2/3/4) =";cin>>opt;
switch (opt)
{ case'1':
cout<<"a+b="<<jum;
break;
case'2':
cout<<"a-b="<<kur;
break;
case'3':
cout<<"a*b="<<kal;
break;
case'4':
cout<<"a/b="<<bag;
break;
default: cout<<"operator yang anda masukkan salah";}
getch();
}
0 komentar:
Posting Komentar