Advertisement
Spocoman

01. Guinea Pig

Nov 9th, 2023
518
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     double food, hay,cover, weight;
  8.     cin >> food >> hay >> cover >> weight;
  9.  
  10.     for (int i = 1; i <= 30; i++) {
  11.         food -= 0.3;
  12.         if (i % 2 == 0) {
  13.             hay -= food * 0.05;
  14.         }
  15.         if (i % 3 == 0) {
  16.             cover -= weight / 3;
  17.         }
  18.     }
  19.  
  20.     if (food < 0 || hay < 0 || cover < 0) {
  21.         cout << "Merry must go to the pet store!" << endl;
  22.     }
  23.     else {
  24.         printf("Everything is fine! Puppy is happy! Food: %.2f, Hay: %.2f, Cover: %.2f.", food, hay, cover);
  25.     }
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement