Advertisement
desislava_topuzakova

05. Small Shop

Jan 22nd, 2023
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. string product;
  7. string city;
  8. double quantity;
  9.  
  10. cin >> product >> city >> quantity;
  11.  
  12. double price = 0;
  13.  
  14. if (city == "Sofia") {
  15. if (product == "coffee") {
  16. price = 0.5;
  17. }
  18. else if (product == "water") {
  19. price = 0.8;
  20. }
  21. else if (product == "beer") {
  22. price = 1.2;
  23. }
  24. else if (product == "sweets") {
  25. price = 1.45;
  26. }
  27. else if (product == "peanuts") {
  28. price = 1.6;
  29. }
  30. }
  31. else if (city == "Plovdiv") {
  32.  
  33. if (product == "coffee") {
  34. price = 0.4;
  35. }
  36. else if (product == "water") {
  37. price = 0.7;
  38. }
  39. else if (product == "beer") {
  40. price = 1.15;
  41. }
  42. else if (product == "sweets") {
  43. price = 1.3;
  44. }
  45. else if (product == "peanuts") {
  46. price = 1.5;
  47. }
  48. }
  49. else if (city == "Varna") {
  50. if (product == "coffee") {
  51. price = 0.45;
  52. }
  53. else if (product == "water") {
  54. price = 0.7;
  55. }
  56. else if (product == "beer") {
  57. price = 1.1;
  58. }
  59. else if (product == "sweets") {
  60. price = 1.35;
  61. }
  62. else if (product == "peanuts") {
  63. price = 1.55;
  64. }
  65. }
  66.  
  67. cout << quantity * price;
  68.  
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement