Electrical and Computer Engineering
42 of 45
UAH
CPE 112
Problem Solving Case Study
•int main()
•{
•    float sum;           // Sum of 12 rainfall amounts
•    char  response;      // User response ('y' or 'n')
•
•    cout << fixed << showpoint          // Set up floating pt.
•         << setprecision(2);            //   output format
•    do
•    {
•        Get12Amounts(sum);
•        cout << endl << "Average rainfall is " << sum / 12.0
•             << " inches" << endl << endl;
•        cout << "Do you have another recording site? (y or n) ";
•        GetYesOrNo(response);
•    } while (response == 'y');
•    return 0;
•}