TpC0GUO0GfMlBUd6TfW5BUOoBA==
Skip to main content

Kalkulator Sederhana Dari Bahasa C++ KALKULATOR SEDERHANA BERBASIS PBO C++



Code:
#include"conio.h"
#include"iostream.h"
class calculator
{
private:
float angka_1,angka_2,hasil;
char operasi,eksekusi;
public:
void masukan ();
void proses ();
void keluaran ();
};
void calculator::masukan ()
{
cout<<"Masukkan Angka
pertama = "; cin>>angka_1;
cout<<"Jenis Operasi
perhitungan * / + - = ";
cin>>operasi;
cout<<"Masukkan Angka kedua =
"; cin>>angka_2;
}
void calculator::proses ()
{
if(operasi=='*')
{
hasil=angka_1*angka_2;
}
else if(operasi=='/')
{
hasil=angka_1/angka_2;
}
else if(operasi=='+')
{
hasil=angka_1+angka_2;
}
else if(operasi=='-')
{
hasil=angka_1-angka_2;
}
}
void calculator::keluaran()
{
cout<<"Tekan tombol (=) "; do
{ cin>>eksekusi;
if(eksekusi=='=')
{
cout<<"Hasil perhitungan =
"<<<"Anda tidak menekan
tombol sama dengan (=)
"; } }while(eksekusi!='='); } void
main() { class calculator jadi; char
pil; do { clrscr(); jadi.masukan();
jadi.proses(); jadi.keluaran();
cout<<"Apakah anda ingin
mengulang? (y or n) "; cin>>pil;
}while(pil=='y'||pil=='Y');
}

Kalkulator Sederhana Dari Bahasa C++ KALKULATOR SEDERHANA BERBASIS PBO C++

0

0 Comments for "Kalkulator Sederhana Dari Bahasa C++ KALKULATOR SEDERHANA BERBASIS PBO C++"

Related Post

Lorem ipsum madolor sit amet, consectetur adipisicing elit.

Click on one of our representatives below to chat on WhatsApp

img
Customer Service Nina Lawson
6281234567891
img
Billing Albert Henderson
6281977094282
img
Support Sufiya Elija
6281977094283
img
Support Pabelo Mukrani
6281977094284
img
Sales Laila Lan
6281977094285
We run on Goomsite.Net
Hello! What can I do for you?

Need help? Let's chat with us!

Added Successfully