Advertisement
Spocoman

05. Small Shop

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