|
|
|
|
|
|
|
// Print result
cout < The result is equal to
< setprecision(7) < area < endl;
return 0;
}
//******************************************************************
void GetData( /* out */ float& low, // Bottom of interval
/* out */ float& high, // Top of interval
/* out */ int& divisions ) // Division factor
// Prompts for the input of low, high, and divisions values
// and returns the three values after echo printing them
// 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
< setprecision(7) < low < endl
< to < high < with <divisions
< subdivisions of the interval. < endl;
}
//******************************************************************
float RectArea( /* in */ float leftEdge, // Left edge point of
// rectangle
/* in */ float width ) // Width of rectangle
// Computes the area of a rectangle that starts at leftEdge and is
//width units wide. The rectangle's height is given by the value
// computed by Funct at the horizontal midpoint of the rectangle
// Precondition:
// leftEdge and width are assigned
// Postcondition:
// Function value == area of specified rectangle
|
|
|
|
|
|