kalkulator sederhana

#include <cstdlib>
#include <iostream>
#include <math.h>
#include <cmath>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
float r,s,t, pilih;
kalkulator :
system("cls");
cout<<"**===========================================================================**\n";
cout<<"\t\t\t=====KALKULATOR SEDERHANA=====\n"<<endl;
cout<<"\t\t\t\t::BETTY RATNA SARI ::\n";
cout<<"**===========================================================================**\n";
cout<<"Nilai A : ";
cin>>r;
cout<<"Nilai B : ";
cin>>s;
cout<<"**===========================================================================**\n";
cout<<" '+' = Penjumlahan [1]"<<endl;
cout<<" '-' = Pengurangan [2]"<<endl;
cout<<" '*' = Perkalian [3]"<<endl;
cout<<" '/' = Pembagian [4]"<<endl;
cout<<" '^' = Perpangkatan [5]"<<endl;
cout<<"Masukan Operasi : ";
cin>>pilih;
if (pilih==1){
t=r+s;
cout<<"Hasil Penjumlahan : "<<t<<endl;
}
if (pilih==2){
t=r-s;
cout<<"Hasil Pengurangan : "<<t<<endl;
}
if (pilih==3){
t=r*s;
cout<<"Hasil Perkalian : "<<t<<endl;
}
if (pilih==4){
t=r/s;
cout<<"Hasil Pembagian : "<<t<<endl;
}
if (pilih==5){
t-pow(r,s);
cout<<"Hasil Perpangkatan : "<<t<<endl;
}
system("pause");
return 0;
}
Previous
Next Post »
Copyright © 2015 Bettong'rs All Right Reserved
Created by Arlina Design Powered by Blogger