#include<iostream>
#include<conio.h>
#include<string>
using namespace std;
int main()
{
string brg1,brg2,brg3,brg4,brg5;
int byk1,byk2,byk3,byk4,byk5,jml1,jml2,jml3,jml4,jml5,total,kbl,byr, j;
int contaktor=50000,relay=20000,cable=535000,monitor=830000, solder =50000;
cout <<"==============================================" <<endl ;
cout <<" SIMATUPANG ELEKTRONIK" << endl;
cout << "============================================="<<endl ;
cout <<"petunjuk penggunaan "<<endl;
cout <<"tekan angka :" <<endl;
cout <<"1. jika ingin melihat daftar produk"<<endl;
cout <<"2.jika ingin menghitung jumlah pembayaran produk "<<endl;
cout << "============================================="<<endl ;
testa :
cout << "SIMATUPANG ELEKTRONIK"<<endl ;
cin >> j;
if (j==1)
{
cout <<"==============================================" <<endl ;
cout <<" SIMATUPANG ELEKTRONIK" << endl;
cout << "============================================="<<endl ;
cout << "1.contaktor = Rp.50000,-"<< endl;
cout << "2.relay = Rp.20000,-"<< endl;
cout << "3.cable = Rp.535000,-"<< endl;
cout << "4.monitor = Rp.830000,-"<< endl;
cout << "5.solder = Rp.50000,-"<< endl;
cout <<"==============================================" <<endl ;
}
if (j==2)
{
cout <<"Input nama barang 1 : "; cin >> brg1;
cout <<"Banyak barang : "; cin >> byk1;
jml1 = byk1 * contaktor;
cout <<"Jumlah 1 : Rp. "<< jml1 << endl << endl;
cout <<"Input nama barang 2 : "; cin >> brg2;
cout <<"Banyak barang : "; cin >> byk2;
jml2 = byk2 * relay;
cout <<"Jumlah 2 : Rp. "<< jml2 << endl << endl;
cout <<"Input nama barang 3 : "; cin >> brg3;
cout <<"Banyak barang : "; cin >> byk3;
jml3 = byk3 * cable;
cout <<"Jumlah 3 : Rp. "<< jml3 << endl << endl;
cout <<"Input nama barang 4 : "; cin >> brg4;
cout <<"Banyak barang : "; cin >> byk4;
jml4 = byk4 * monitor;
cout <<"Jumlah 4 : Rp. "<< jml4 << endl << endl;
cout <<"Input nama barang 5 : "; cin >> brg5;
cout <<"Banyak barang : "; cin >> byk5;
jml5 = byk5 * solder;
cout <<"Jumlah 5 : Rp. "<< jml5 << endl << endl;
cout <<"======================================"<< endl;
total = jml1+jml2+jml3+jml4+jml5;
cout <<"Total pembayaran:"<<total<< endl;
cout<<"======================================="<<endl;
cout<<"dibayar : Rp. ";cin >> byr;
kbl = byr - total ;
cout<< "total kembalian: Rp."<<kbl<<endl;
cout <<"======================================="<< endl;
cout <<" Terima kasih ! "<< endl;
cout <<"======================================="<< endl;
}
goto testa;
if (j<=0)
{
goto testa;
}
if (j>2)
{
goto testa;
}
getch();
}
Berikut adalah contoh dari hasil compilenya :

Mantap ilmunya gan
BalasHapus