Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<math.h>
- #include<conio.h>
- using namespace std;
- int main()
- {
- start:
- int kode;
- int diskon = 20;//diskon 20%
- int jumlahbarang;
- int potonganharga=0;
- int harga;
- system("cls");
- cout<<" ==============================================================================="<<endl;
- cout<<" KODE | TIPE EMAS | GRAM | HARGA |"<<endl;
- cout<<" _____|__________________________|____________________|_________________________|"<<endl;
- cout<<" 1 | EMAS 24 KARAT | 1 | Rp. 557.000 |"<<endl;
- cout<<" 2 | EMAS 22 KARAT | 1 | Rp. 473.500 |"<<endl;
- cout<<" 3 | EMAS CAMPURAN | 1 | Rp. 320.500 |"<<endl;
- cout<<" ==============================================================================="<<endl;
- cout<<"\nPILIH KODE TIPE EMAS YANG INGIN KAMU BELI : "; cin>>kode;
- cout<<"\nJUMLAH PEMBELIAN = "; cin>>jumlahbarang;
- cout<<endl;
- cout<<"==============================================================================="<<endl;
- if(kode>3)
- {
- system("cls");
- cout<<"MAAF TIDAK ADA BARANG DENGAN KODE : "<<kode;
- cout<<endl<<endl<<endl;
- system("pause");
- system("cls");
- goto start;
- }
- switch(kode)
- {
- case 1 :
- {
- cout<<"ANDA MEMBELI EMAS 24 KARAT DENGAN KODE : "<<kode;
- harga= 557000*jumlahbarang ;
- }
- break;
- case 2 :
- {
- cout<<"ANDA MEMBELI EMAS EMAS 22 KARAT KARAT DENGAN KODE : "<<kode;
- harga= 473500*jumlahbarang;
- }
- break;
- case 3 :
- {
- cout<<"ANDA MEMBELI EMAS EMAS CAMPURAN KARAT DENGAN KODE : "<<kode;
- harga= 320500*jumlahbarang;
- }
- break;
- }
- cout<<endl;
- cout<<"\nJUMLAH EMAS YANG ANDA BELI\t: "<<jumlahbarang<<endl;
- cout<<"HARGA EMAS YANG ANDA BELI\t: Rp."<<harga<<endl;
- //printf("%d",harga);
- if(jumlahbarang>5)
- {
- cout<<"\DISKON\t\t\t\t: "<<diskon<<"%"<<endl;
- potonganharga = harga*diskon/100;
- }
- cout<<"\POTONGAN HARGA\t\t\t: Rp."<<potonganharga<<endl;
- cout<<"\TOTAL HARGA\t\t\t: Rp."<<harga-potonganharga<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment