#include <iostream>
#include <iomanip> // For std::setprecision
using namespace std;
int main() {
double total = 0.0;
int counter = 0;
double grade = 0.0;
cout << "Enter grade (-1 to end): ";
cin >> grade;
while (grade != -1) {
total += grade;
counter++;
cout << "Enter grade (-1 to end): ";
cin >> grade;
}
double average = total / counter; cout << "Class average = " << fixed
<< setprecision(4) << average << endl;
return 0;
}
=======================
Task 5.2: How might you improve the code to overcome any unacceptable behaviors in the
program .
Task 5.3: The user wants also to find the minimum and the maximum of all entered grades. How
might you modify the code to allow this new requirement?
Hint: assume the biggest number for the minimum variable and the smallest number for the
maximum variable with which you start.