Advertisement
Guest User

Ice Cream C++

a guest
Nov 22nd, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <stdio.h>
  4. #include <string.h>
  5. #include <stdlib.h>
  6. using namespace std;
  7.  
  8. main()
  9. {
  10. char rasa[3],nama[30],pembeli[30],input;
  11. int harga,jumlah,total,jumtotal,jumbayar,kembalian,potongan;
  12.  
  13. system("cls");
  14. awal:
  15. cout<<"============================================"<<endl;
  16. cout<<" CM ICE CREAM "<<endl;
  17. cout<<"============================================"<<endl;
  18. cout<<"Input Nama Pembeli : ";cin>>pembeli;
  19. cout<<"Pilihan Rasa Ice Cream Yang Tersedia"<<endl;
  20. cout<<">1. Chocolate Strawberry"<<endl;
  21. cout<<">2. Chocolate Vanilla"<<endl;
  22. cout<<">3. Chocolate Capucinno"<<endl;
  23. cout<<"Ice Cream Yang Anda Pilih : ";cin>>rasa;
  24. cout<<"Jumlah Beli : ";cin>>jumlah;
  25.  
  26. if(strcmp(rasa,">1.")==0){
  27. strcpy(nama,"Chocolate Strawberry");
  28. harga=15000;
  29. }
  30. else if(strcmp(rasa,">2.")==0){
  31. strcpy(nama,"Chocolate Vanilla");
  32. harga=20000;
  33. }
  34. else{
  35. strcpy(nama,"Chocolate Capucinno");
  36. harga=25000;
  37. }
  38.  
  39. system("cls");
  40. cout<<"============================================"<<endl;
  41. cout<<"Nama Pembeli : "<<pembeli<<endl;
  42. cout<<"Nama Ice Cream : "<<nama<<endl;
  43. cout<<"Harga : "<<harga<<endl;
  44. cout<<"Jumlah : "<<jumlah<<endl;
  45. total=harga*jumlah;
  46. cout<<"Total : "<<total<<endl;
  47. if(rasa==">1."||total>40000){
  48. potongan=0.05*total;
  49. }
  50. else if(rasa==">2."&&total>50000){
  51. potongan=0.1*total;
  52. }
  53. else{
  54. potongan=0;
  55. }
  56. cout<<"Potongan : "<<potongan<<endl;
  57. cout<<"============================================"<<endl;
  58.  
  59. jumtotal=total-potongan;
  60. cout<<"Total Keseluruhan Harga : "<<jumtotal<<endl;
  61. cout<<"Uang Bayar : ";cin>>jumbayar;
  62. kembalian=jumbayar-jumtotal;
  63. cout<<"Uang Kembali : "<<kembalian<<endl;
  64. cout<<"============================================"<<endl;
  65.  
  66. cout<<"Mau Beli Lagi[Y/N]? : ";cin>>input;
  67. if(input=='Y'||input=='y')
  68. goto awal;
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement