Advertisement
Spocoman

Grandpa Stavri

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