Advertisement
Spocoman

Hair Salon

Sep 20th, 2023
524
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. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     int target, sum = 0;
  8.     cin >> target;
  9.  
  10.     string service, category;
  11.    
  12.     while (target > sum) {
  13.         cin >> service;
  14.         if (service == "closed") {
  15.             break;
  16.         }
  17.        
  18.         cin.ignore();
  19.         getline(cin, category);
  20.  
  21.         if (service == "haircut") {
  22.             if (category == "mens") {
  23.                 sum += 15;
  24.             }
  25.             else if (category == "ladies") {
  26.                 sum += 20;
  27.             }
  28.             else if (category == "kids") {
  29.                 sum += 10;
  30.             }
  31.         }
  32.         else if (service == "color") {
  33.             if (category == "touch up") {
  34.                 sum += 20;
  35.             }
  36.             else if (category == "full color") {
  37.                 sum += 30;
  38.             }
  39.         }
  40.     }
  41.  
  42.     if (sum >= target) {
  43.         cout << "You have reached your target for the day!\n";
  44.     }
  45.     else {
  46.         cout << "Target not reached! You need " << target - sum << "lv. more.\n";
  47.     }
  48.     cout << "Earned money: " << sum << "lv.\n";
  49.  
  50.     return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement