Advertisement
JOHNYTHEWINNER

Actors-budget

Jan 23rd, 2020
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.14 KB | None | 0 0
  1. # include <iostream>
  2. using namespace std;
  3. #include <iomanip>
  4. #include <math.h>
  5. #include <cmath>
  6.  
  7. int main()
  8. {
  9.     double budget;
  10.     int statists;
  11.     double price;
  12.  
  13.     do
  14.     {
  15.         cin.clear();
  16.         cin >> budget;
  17.     } while (cin.bad() || budget < 1 || budget> 1000000);
  18.  
  19.     do
  20.     {
  21.         cin.clear();
  22.         cin >> statists;
  23.     } while (cin.bad() || statists < 1 || statists> 500);
  24.  
  25.     do
  26.     {
  27.         cin.clear();
  28.         cin >> price;
  29.     } while (cin.bad() || price < 1 || price> 1000);
  30.  
  31.     double decor = budget * 0.1;
  32.     double dressprice = price*statists;
  33.     if (statists >= 150)
  34.     {
  35.         dressprice = (price * statists) * 0.9;
  36.     }
  37.     if (budget < (decor + dressprice))
  38.     {
  39.         cout << "Not enough money!" << endl;
  40.         cout << fixed << setprecision(2) << "Wingard needs " << (decor+dressprice-budget) <<" leva more." << endl;
  41.     }
  42.     if (budget >= (decor + dressprice))
  43.     {
  44.         cout << "Action!" << endl;
  45.         cout << fixed << setprecision(2) << "Wingard starts filming with " << (budget - decor - dressprice) << " leva left." << endl;
  46.     }
  47.  
  48.  
  49.  
  50.     return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement