Advertisement
mark79

Small Shop

Aug 12th, 2019
510
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.63 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     string product, town;
  8.     double quantity, price;
  9.     cin >> product >> town >> quantity;
  10.  
  11.     price = 0;
  12.     if (town == "Sofia")
  13.     {
  14.         if (product == "coffee")
  15.         {
  16.             price = 0.50;
  17.         }
  18.         else if (product == "beer")
  19.         {
  20.             price = 1.20 ;
  21.         }
  22.         else if (product == "water")
  23.         {
  24.             price = 0.80;
  25.         }
  26.         else if (product == "sweets")
  27.         {
  28.             price = 1.45;
  29.         }
  30.         else if (product == "peanuts")
  31.         {
  32.             price = 1.60;
  33.         }
  34.     }
  35.     else if (town == "Varna")
  36.     {
  37.         if (product == "coffee")
  38.         {
  39.             price = 0.45;
  40.         }
  41.         else if (product == "beer")
  42.         {
  43.             price = 1.10;
  44.         }
  45.         else if (product == "water")
  46.         {
  47.             price = 0.70;
  48.         }
  49.         else if (product == "sweets")
  50.         {
  51.             price = 1.35;
  52.         }
  53.         else if (product == "peanuts")
  54.         {
  55.             price = 1.55;
  56.         }
  57.     }
  58.     else if (town == "Plovdiv")
  59.     {
  60.         if (product == "coffee")
  61.         {
  62.             price = 0.40;
  63.         }
  64.         else if (product == "beer")
  65.         {
  66.             price = 1.15;
  67.         }
  68.         else if (product == "water")
  69.         {
  70.             price = 0.70;
  71.         }
  72.         else if (product == "sweets")
  73.         {
  74.             price = 1.30;
  75.         }
  76.         else if (product == "peanuts")
  77.         {
  78.             price = 1.50;
  79.         }
  80.     }
  81.  
  82.     cout << price * quantity << endl;
  83.  
  84.     return 0;
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement