Advertisement
Derga

Untitled

Feb 27th, 2023
577
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. /*
  2. Задание 1. Про кроликов
  3. */
  4.  
  5. #include <iostream>
  6. #include <locale>
  7.  
  8. using namespace std;
  9.  
  10. int main() {
  11.     setlocale(LC_ALL, "Russian");
  12.  
  13.     double food_cost = 0;
  14.     cin >> food_cost;
  15.     const double cost_of_the_rabbit = food_cost + (food_cost / 100 * 30);
  16.     double store_commission = cost_of_the_rabbit / 4;
  17.     double profit_from_one_rabbit = cost_of_the_rabbit - store_commission;
  18.  
  19.     size_t rabbits_count;
  20.     cin >> rabbits_count;
  21.  
  22.     const int FIFTEEN_THOUSAND = 15'000;
  23.  
  24.    if (cost_of_the_rabbit * rabbits_count < FIFTEEN_THOUSAND) {
  25.        cout << "Число кроликов = " << rabbits_count << ", они бдут стоить " << cost_of_the_rabbit * rabbits_count << " рублей.";
  26.    } else {
  27.        cout << "СЛИШКОМ МНОГО КРОЛИКОВ!";
  28.    }
  29.  
  30.    return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement