Advertisement
Guest User

Ski-trip

a guest
Jan 30th, 2020
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.18 KB | None | 0 0
  1. #include <iostream>
  2. #include<string>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int stayOfDays;
  8.     cin >> stayOfDays;
  9.     string type, mark;
  10.     cin >> type >> mark;
  11.     double price = 0.0;
  12.    
  13.  
  14.  
  15.     if (type == "room for one person") {
  16.         if (stayOfDays <= 10 && stayOfDays <= 15 && stayOfDays > 15) {
  17.             price = stayOfDays * 18;
  18.         }
  19.     }
  20.     else if (type == "apartment") {
  21.         if (stayOfDays <= 10) {
  22.             price = stayOfDays * 25 * 0.7;
  23.  
  24.         }
  25.         else if (stayOfDays <= 15) {
  26.             price = stayOfDays * 25 * 0.65;
  27.  
  28.         }
  29.         else if (stayOfDays > 15) {
  30.             price = stayOfDays * 25 * 0.5;
  31.  
  32.         }
  33.     }
  34.     else if (type == "president apartment") {
  35.         if (stayOfDays <= 10) {
  36.             price = stayOfDays * 35 * 0.9;
  37.  
  38.         }
  39.         else if (stayOfDays <= 15) {
  40.             price = stayOfDays * 35 * 0.85;
  41.         }
  42.         else if (stayOfDays > 15) {
  43.             price = stayOfDays * 35 * 0.8;
  44.  
  45.         }
  46.     }
  47.     if (mark == "positive") {
  48.        price *= 1.25;
  49.     }
  50.     else if (mark == "negative") {
  51.         price *= 0.9;
  52.     }
  53.  
  54.     cout << price << endl;
  55.  
  56.     return 0;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement