desislava_topuzakova

01. Pool Day

Feb 20th, 2021
809
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.10 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <math.h>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int countPeople;
  9.     cin >> countPeople;
  10.  
  11.     double priceEnter, priceSunbed, priceUmbrella;
  12.     cin >> priceEnter >> priceSunbed >> priceUmbrella;
  13.  
  14.     //обща сума = цена за входа + цена за шезлонги +  цена за чадъри
  15.     //цена за входа = бр. хората * цена за 1 човек вход
  16.     //цена за шезлонгите = бр. шезлонгите * цена за 1 шезлонг
  17.     //цена за чадъри = бр. чадърите * цена за 1 чадър
  18.  
  19.     double totalPriceEnter = countPeople * priceEnter;
  20.  
  21.     int countSunbeds = ceil(0.75 * countPeople);
  22.     double totalPriceSunbeds = countSunbeds * priceSunbed;
  23.  
  24.     int countUmrellas = ceil(countPeople / 2.0);
  25.     double totalPriceUmbrellas = countUmrellas * priceUmbrella;
  26.  
  27.     cout.setf(ios::fixed);
  28.     cout.precision(2);
  29.     double totalPrice = totalPriceEnter + totalPriceSunbeds + totalPriceUmbrellas;
  30.     cout << totalPrice << " lv." << endl;
  31.  
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment