desislava_topuzakova

06. Godzilla vs. Kong

Jan 17th, 2021
1,136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.35 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     //вход
  8.     double budget;
  9.     cin >> budget;
  10.     int countStatists;
  11.     cin >> countStatists;
  12.     double pricePerStatist;
  13.     cin >> pricePerStatist;
  14.  
  15.     //декор = 10% от бюджета
  16.     double priceDecor = 0.1 * budget;
  17.  
  18.     //облекло = брой статистите * цена за 1 статист
  19.     double priceClothes = countStatists * pricePerStatist;
  20.  
  21.     //!!отстъпка от крайната цена за облеклото -> брой > 150 -> обекло - 10%
  22.     if (countStatists > 150) {
  23.         priceClothes = priceClothes - priceClothes * 0.10;
  24.         //priceClothes = priceClothes * 0.9
  25.         //priceClothes *= 0.9
  26.     }
  27.  
  28.     //сума за разходи =  декор + облекло
  29.     double sumExpenses = priceDecor + priceClothes;
  30.  
  31.     cout.setf(ios::fixed);
  32.     cout.precision(2);
  33.     //проверка дали бюджетът е достатъчен
  34.     if (sumExpenses > budget) {
  35.         //не ми стиггат парите
  36.         cout << "Not enough money!" << endl;
  37.         cout << "Wingard needs " << sumExpenses - budget << " leva more.";
  38.     }  else {
  39.         cout << "Action!" << endl;
  40.         cout << "Wingard starts filming with " << budget - sumExpenses << " leva left.";
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment