Kutu_Kucing

mas

Apr 3rd, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.19 KB | None | 0 0
  1. #include<iostream>
  2. #include<math.h>
  3. #include<conio.h>
  4. using namespace std;
  5.  
  6.  
  7.  
  8. int main()
  9. {
  10. start:
  11. int kode;
  12. int diskon = 20;//diskon 20%
  13. int jumlahbarang;
  14. int potonganharga=0;
  15. int harga;
  16. system("cls");
  17.  
  18.         cout<<" ==============================================================================="<<endl;
  19.         cout<<"  KODE |        TIPE EMAS         |        GRAM        |          HARGA          |"<<endl;
  20.         cout<<"  _____|__________________________|____________________|_________________________|"<<endl;
  21.         cout<<"    1  | EMAS 24 KARAT            |          1         |       Rp. 557.000       |"<<endl;
  22.         cout<<"    2  | EMAS 22 KARAT            |          1         |       Rp. 473.500       |"<<endl;
  23.         cout<<"    3  | EMAS CAMPURAN            |          1         |       Rp. 320.500       |"<<endl;
  24.         cout<<" ==============================================================================="<<endl;
  25.  
  26.         cout<<"\nPILIH KODE TIPE EMAS YANG INGIN KAMU BELI : "; cin>>kode;
  27.         cout<<"\nJUMLAH PEMBELIAN   = "; cin>>jumlahbarang;
  28.         cout<<endl;
  29.         cout<<"==============================================================================="<<endl;
  30.         if(kode>3)
  31.         {
  32.             system("cls");
  33.             cout<<"MAAF TIDAK ADA BARANG DENGAN KODE : "<<kode;
  34.             cout<<endl<<endl<<endl;
  35.             system("pause");
  36.             system("cls");
  37.             goto start;
  38.         }
  39.      switch(kode)
  40.      {
  41.       case 1 :
  42.           {
  43.             cout<<"ANDA MEMBELI EMAS 24 KARAT DENGAN KODE : "<<kode;
  44.           harga= 557000*jumlahbarang ;
  45.           }
  46.           break;
  47.       case 2 :
  48.               {
  49.             cout<<"ANDA MEMBELI EMAS EMAS 22 KARAT KARAT DENGAN KODE : "<<kode;
  50.           harga= 473500*jumlahbarang;
  51.           }
  52.           break;
  53.       case 3 :
  54.           {
  55.             cout<<"ANDA MEMBELI EMAS EMAS CAMPURAN KARAT DENGAN KODE : "<<kode;
  56.           harga= 320500*jumlahbarang;
  57.           }
  58.           break;
  59.      }
  60.     cout<<endl;
  61.     cout<<"\nJUMLAH EMAS YANG ANDA BELI\t: "<<jumlahbarang<<endl;
  62.     cout<<"HARGA EMAS YANG ANDA BELI\t: Rp."<<harga<<endl;
  63.     //printf("%d",harga);
  64.  
  65.     if(jumlahbarang>5)
  66.     {
  67.         cout<<"\DISKON\t\t\t\t: "<<diskon<<"%"<<endl;
  68.         potonganharga = harga*diskon/100;
  69.  
  70.     }
  71.  
  72.     cout<<"\POTONGAN HARGA\t\t\t: Rp."<<potonganharga<<endl;
  73.     cout<<"\TOTAL  HARGA\t\t\t: Rp."<<harga-potonganharga<<endl;
  74. return 0;
  75. }
Advertisement
Add Comment
Please, Sign In to add comment