Advertisement
Guest User

Toko Es Krim

a guest
Nov 22nd, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <stdlib.h>
  4. #include <string>
  5. using namespace std;
  6. int main(){
  7. char ulang;
  8. string es, nama;
  9. int total,harga,pilih,jumlah,hasil,diskon,uang,kembalian;
  10. mulai:
  11. cout<<"=================================="<<endl;
  12. cout<<"==========Toko ICE CREAM=========="<<endl;
  13. cout<<"=================================="<<endl<<endl;
  14. cout<<" input nama pembeli:";cin>>nama;cout<<endl;
  15. cout<<" pilihan es krim yang tersedia:"<<endl;
  16. cout<<"1. Chocolate Strowberry"<<endl;
  17. cout<<"2. Chocolate Vanila"<<endl;
  18. cout<<"3. Chocolate Capucinno"<<endl;
  19. cout<<"es krim yang dipilih: ";cin>>pilih;
  20. switch(pilih){
  21. case 1:
  22. harga=15000;
  23. es="Chocolate Strowberry";
  24. break;
  25. case 2:
  26. harga=20000;
  27. es="Chocolate Vanila";
  28. break;
  29. case 3:
  30. harga=25000;
  31. es="Chocolate Capucinno";
  32. break;
  33. }
  34. cout<<"jumlah beli:";cin>>jumlah;
  35. cout<<"Uang pembeli:";cin>>uang;
  36. total = jumlah * harga;
  37. if(total>50000){
  38. diskon = total * 0.10;
  39. }else if(total>40000 && total<50000){
  40. diskon = total * 0.05;
  41. }else if(total < 40000){
  42. diskon = total * 0;
  43. }
  44. hasil = total - diskon;
  45. kembalian = uang - hasil;
  46. system("cls");
  47. cout<<"=============================="<<endl;
  48. cout<<" Struk Pembayaran"<<endl;
  49. cout<<"=============================="<<endl;
  50. cout<<"Nama pembeli: "<<nama<<endl;
  51. cout<<"Nama es krim: "<<es<<endl;
  52. cout<<"Harga: "<<harga<<endl;
  53. cout<<"Total: "<<total<<endl;
  54. cout<<"potongan: "<<diskon<<endl;
  55. cout<<"=============================="<<endl;
  56. cout<<"Total keseluruhan: "<<hasil<<endl;
  57. cout<<"Uang bayar: "<<uang<<endl;
  58. cout<<"Uang kembali: "<<kembalian<<endl;
  59. cout<<"Mau input lagi(Y/N)?";cin>>ulang;
  60. if(ulang=='Y' || ulang=='y'){
  61. system("cls");
  62. goto mulai;
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement