Electrical and Computer Engineering
12 of 14
UAH
CPE 112
Problem-Solving Case Study:
Finding the Area Under a Curve
•void GetData( /* out */ float& low,         // Bottom of interval
•              /* out */ float& high,        // Top of interval
•              /* out */ int&   divisions )  // Division factor
•// Postcondition:
•//     All parameters (low, high, and divisions)
•//     have been prompted for, input, and echo printed
•{ 
•    cout << "Enter low and high values of desired interval"
•         << " (floating point)." << endl;
•    cin >> low >> high;
•    cout << "Enter the number of divisions to be used (integer)."   << endl;
•    cin >> divisions;
•    cout << "The area is computed over the interval “ << low
•         << endl << "to " << high << "   with " << divisions
•           << " subdivisions of the interval." << endl;
•}