Advertisement
DidiMilikina

04.Grandpa Stavri

Oct 8th, 2017
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int days;
  8.     cin >> days;
  9.     double total_liters = 0;
  10.     double total_degrees = 0;
  11.  
  12.     for (int i = 0; i < days; ++i)
  13.     {
  14.         double liters;
  15.         double degrees;
  16.         cin >> liters >> degrees;
  17.  
  18.         total_liters = total_liters + liters;
  19.         total_degrees = total_degrees + liters * degrees;
  20.     }
  21.  
  22.     double degrees_all_alcohol = total_degrees / total_liters;
  23.  
  24.     cout << "Liter: " << fixed << setprecision(2) << total_liters << endl;
  25.     cout << "Degrees: " << fixed << setprecision(2) << degrees_all_alcohol << endl;
  26.  
  27.     if (degrees_all_alcohol < 38)
  28.     {
  29.         cout << "Not good, you should baking!" << endl;
  30.     }
  31.     else if (degrees_all_alcohol >= 38 && degrees_all_alcohol <= 42)
  32.     {
  33.         cout << "Super!" << endl;
  34.     }
  35.     else
  36.     {
  37.         cout << "Dilution with distilled water!" << endl;
  38.     }
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement