Advertisement
Spocoman

Movie Stars

Sep 21st, 2023
492
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     double budget, salary;
  8.     cin >> budget;
  9.     cin.ignore();
  10.  
  11.     string actor;
  12.  
  13.     while (budget >= 0) {
  14.        
  15.         getline(cin, actor);
  16.         if (actor == "ACTION") {
  17.             break;
  18.         }
  19.  
  20.         if (actor.length() <= 15) {
  21.             cin >> salary;
  22.             cin.ignore();
  23.             budget -= salary;
  24.         }
  25.         else {
  26.             budget *= 0.8;
  27.         }
  28.     }
  29.  
  30.     if (budget < 0) {
  31.         printf("We need %.2f leva for our actors.\n", abs(budget));
  32.     }
  33.     else {
  34.         printf("We are left with %.2f leva.\n", budget);
  35.     }
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement