Advertisement
Spocoman

Safari

Sep 21st, 2023
920
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     double budget, fuel;
  8.     cin >> budget >> fuel;
  9.  
  10.     string day;
  11.     cin >> day;
  12.  
  13.     double sum = 2.10 * fuel + 100;
  14.  
  15.     if (day == "Saturday") {
  16.         sum *= 0.90;
  17.     }
  18.     else {
  19.         sum *= 0.80;
  20.     }
  21.  
  22.     if (budget >= sum) {
  23.         printf("Safari time! Money left: %.2f lv.\n", budget - sum);
  24.     }
  25.     else{
  26.         printf("Not enough money! Money needed: %.2f lv.\n", sum - budget);
  27.     }
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement