Advertisement
Guest User

Untitled

a guest
Jan 21st, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.69 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4.  
  5. double PLN=0;
  6. float EURO;
  7. float US;
  8. int coffee;
  9. float change;
  10. double totalEUR;
  11. double totalUS;
  12.  
  13. using namespace std;
  14.  
  15. int main(int argc, char** argv) {
  16. cout << "Please choose one kind of coffee. There are 9 different kinds." << endl;
  17. cout << endl << endl;
  18. cout << "**********************" << endl;
  19. cout << "1. Latte" << endl << "2. Flat White" << endl << "3.Cappucino" << endl << "4.Mocha" << endl << "5.Americano" << endl << "6.Ice Coffee" << endl << "7.Latte Maccihiato" << endl << "8.Caramel Frappucino" << endl << "9.Espresso" << endl;
  20. cout << "**********************" << endl;
  21. cin >> coffee;
  22. EURO=PLN*4.171;
  23. US=PLN*3.40;
  24. switch (coffee){
  25. case 1:
  26. {
  27. cout << "You have chosen Latte. Please insert 5 PLN:" << endl;
  28. cin >> PLN || EURO || US;
  29.  
  30. if (PLN==5)
  31.  
  32. cout << "Thank you. Here's your coffee.";
  33.  
  34. else if (PLN<5.0)
  35.  
  36. cout << "Please insert more money. You have to put " << abs(change) << " more." << endl;
  37.  
  38. else if (PLN>5.0)
  39.  
  40. change=(5-PLN);
  41.  
  42. cout << "Here's your change:" << abs(change);
  43.  
  44. break;}
  45. case 2:
  46. {
  47. cout << "You have chosen Flat White. Please insert 6 PLN:" << endl;
  48. double totalPLN=6;
  49. while(totalPLN>0){
  50. cin>>PLN;da
  51. totalPLN-=PLN;
  52.  
  53. if(PLN<=0)
  54.  
  55. cout << "Thank's. Here's your coffee.";
  56.  
  57. elsed
  58.  
  59. cout << "Please insert " << totalPLN << " more." << "You have entered: " << PLN << " so far." << endl;
  60. }
  61. break;
  62. }
  63. case 3:
  64. {
  65. cout << "You have chosen Cappucino. Please insert 4.50 PLN:" << endl;
  66. cin >> PLN || EURO || US;
  67. if(PLN==4.5)
  68.  
  69. cout << "Thank you. Here's your coffee.";
  70.  
  71. else if (PLN<4.5)
  72.  
  73. cout << "Please insert more money.";
  74.  
  75. else if (PLN>4.5)
  76.  
  77. cout << "Here's your change.";
  78.  
  79. break;}
  80. case 4:
  81. {
  82. cout << "You have chosen Mocha. Please insert 6 PLN:" << endl;
  83. cin >> PLN || EURO || US;
  84. if(PLN==6.0)
  85.  
  86. cout << "Thank you. Here's your coffee.";
  87.  
  88. else double PLN=0;if (PLN<6.0)
  89.  
  90. cout << "Please insert more money.";
  91.  
  92. else if (PLN>6.0)
  93.  
  94. cout << "Here's your change.";
  95.  
  96. break;}
  97. case 5:
  98. {
  99. cout << "You have chosen Americano. Please insert 3.90 PLN:" << endl;
  100. cin >> PLN || EURO || US;
  101. if(PLN==3.9)
  102.  
  103. cout << "Thank you. Here's your coffee.";
  104.  
  105. else if (PLN<3.9)
  106.  
  107. cout << "Please insert more money.";
  108.  
  109. else if (PLN>3.9)
  110.  
  111. cout << "Here's your change.";
  112.  
  113. break;}
  114. case 6:
  115. {
  116. cout << "You have chosen Ice Coffee. Please insert 5 PLN:" << endl;
  117. cin >> PLN || EURO || US;
  118. if(PLN==5.0)
  119.  
  120. cout << "Thank you. Here's your coffee.";
  121.  
  122. else if (PLN<5.0)
  123.  
  124. cout << "Please insert more money.";
  125.  
  126. else if (PLN>5.0)
  127.  
  128. cout << "Here's your change.";
  129.  
  130. break;}
  131. case 7:
  132. {
  133. cout << "You have chosen Latte Maccihiato. Please insert 6.5 PLN:" << endl;
  134. cin >> PLN || EURO || US;
  135. if(PLN==6.5)
  136.  
  137. cout << "Thank you. Here's your coffee.";
  138.  
  139. else if (PLN<6.5)
  140.  
  141. cout << "Please insert more money.";
  142.  
  143. else if (PLN>6.5)
  144.  
  145. cout << "Here's your change.";
  146.  
  147. break;}
  148. case 8:
  149. {
  150. cout << "You have chosen Caramel Frappucino. Please insert 8 PLN:" << endl;
  151. cin >> PLN || EURO || US;
  152. if(PLN==8.0)
  153.  
  154. cout << "Thank you. Here's your coffee.";
  155.  
  156. else if (PLN<8.0)
  157.  
  158. cout << "Please insert more money.";
  159.  
  160. else if (PLN>8.0)
  161.  
  162. cout << "Here's your change.";
  163.  
  164. break;}
  165. case 9:
  166. {
  167. cout << "You have chosen Espresso. Please insert 4.20 PLN:" << endl;
  168. cin >> PLN || EURO || US;
  169. if(PLN==4.20)
  170.  
  171. cout << "Thank you. Here's your coffee.";
  172.  
  173. else if (PLN<4.2)
  174.  
  175. cout << "Please insert more money.";
  176.  
  177. else if (PLN>4.2)
  178.  
  179. cout << "Here's your change.";
  180.  
  181. break;}
  182. }
  183. return 0;
  184. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement