C++ (Program Kalkulator Sederhana)
Program Kalkulator Sederhana pada C++
~Struktur Navigasi, Flowchart, Listing Program,Output Program~
1. Struktur Navigasi
2. Flowchart
3.
Listing Program
#include
<iostream>
#include
<conio.h>
#include
<cstdlib>
#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 x,y,hasil,pilih;
system("cls");
cout<<"\t\t\t
============================\n"<<endl;
cout<<"\t\t\t --- KALKULATOR SEDERHANA
---"<<endl<<endl;
cout<<"\t\t\t
============================"<<endl;
kalkulator :
//operator perhitungan
cout<<"Operator
Perhitungan:"<<endl;
string jumlah ="(1) penjumlahan
(+)";
cout<<jumlah<<endl;
string pengurangan ="(2) pengurangan
(-)";
cout<<pengurangan<<endl;
string perkalian ="(3) perkalian (*)";
cout<<perkalian<<endl;
string pembagian ="(4) pembagian (/)";
cout<<pembagian<<endl<<endl;
//mulai menghitung
cout<<"Masukan Angka A = ";
cin>>x;
cout<<"Masukan Angka B = ";
cin>>y;
int z;
cout<<"Pilih Operator
Perhitungan= ";
cin>>z;
if(z==1)
{
hasil=x+y;
cout<<"Hasil penjumlahan =
"<<hasil<<endl;
}
else if(z==2)
{
hasil=x-y;
cout<<"Hasil pengurangan =
"<<hasil<<endl;
}
else if(z==3)
{
hasil=x*y;
cout<<"Hasil perkalian =
"<<hasil<<endl;
}
else if(z==4)
{
hasil=x/y;
cout<<"Hasil pembagian =
"<<hasil<<endl;
}
cout<<"================================================================================";
cout<<"Coba lagi
[1]"<<endl;
cout<<"Keluar
[2]"<<endl;
cout<<"================================================================================";
cout<<"Masukkan Pilihan :
";cin>>pilih;
if (pilih==1){
goto kalkulator;
}
if (pilih==2){
system("cls");
cout<<"==========================================================="<<endl;
cout<<"\tTerima Kasih Telah
Menggunakan Kalkulator Ini"<<endl<<endl;
cout<<"\tBella Alysha
Vira"<<endl<<endl;
cout<<"\tSistem
Informasi"<<endl<<endl;
cout<<"\t11115319"<<endl<<endl;
cout<<"\t2KA10"<<endl;
cout<<"==========================================================="<<endl;
system("pause");
}
return 0;
}
4.
Output Program
makasih sudah share
BalasHapusalat balon pembersih debu
Definisi Flowchart
BalasHapus