Advertisement
Guest User

kasir.cxx

a guest
May 20th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.32 KB | None | 0 0
  1. #include<iostream.h>
  2. #include<conio.h>
  3. #include<strinh.h>
  4. int main(){
  5.             char*kode;
  6.             char*nama;
  7.             char*bon;
  8.             char ulang;
  9.             long                                                                                    jumlah,harga,total,todis,tobel,bayar,dis;
  10.             clrcr();
  11.             do
  12.             {
  13.             cout<<"kode barang      : "; cin>>kode;
  14.                     if(strcmp(kode,"P17")==0){
  15.                         nama="Lays";
  16.                         harga=9800;
  17.             } else if(strcmp(kode,"Q48")==0){
  18.                         nama="Oreo";
  19.                         harga=8300;
  20.             } else if(strcmp(kode,"R59")==0){
  21.                         nama="Chitato";
  22.                         harga=10400;
  23.             } else if(strcmp(kode,"S60")==0){
  24.                         nama="Timtam";
  25.                         harga=7300;
  26.             }
  27.             cout<<"nama barang      :"<<nama<<endl;
  28.             cout<<"harga barang     :"<<harga<<endl;
  29.             cout<<"jumlah beli          : ";cin>>jumlah;
  30.             total=harga*jumlah;
  31.             cout<<"total                        : "<<total<<endl;
  32.             if (jumlah>=5){
  33.                 todis=total*0.1;
  34.                 tobel=total-todis;
  35.                 cout<<endl;
  36.             } else if (jumlah<=4){
  37.                 todis=0;
  38.                 tobel=total-todis;
  39.                 cout<<endl;
  40.             } else if (jumlah>=3){
  41.                 bon="coklat";
  42.                 cout<<endl;
  43.             } else if (jumlah<=2){
  44.                 bon="tidak ada";
  45.                 cout<<endl;
  46.             }
  47.             cout<<"Diskon               :"<<todis<<endl;
  48.             cout<<"total belanja    :"<<tobel<<endl;
  49.             if (jumlah>=3){
  50.                     bon="coklat";
  51.             } else if (jumlah<=2){
  52.                     bon="tidak ada";
  53.             }
  54.             cout<<"bonus                    :"<<bon<<endl;
  55.             cout<<"masih ada ? Y/T:"; cin>>ulang;
  56.             }
  57.             while(ulang=='Y');
  58.             cout<<"Terimakasih";
  59.             return 0;
  60.             getch();
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement