// Author: Keith Shomper // Date: 10/27/03 // Purpose: To demonstrate function calling by computing the area of a rectangle #include using namespace std; float promptAndGet(string s); float computeArea(float value1, float value2); int main() { float length, width, area; length = promptAndGet("What is the length of the rectangle: "); width = promptAndGet("What is the width of the rectangle: "); area = computeArea(length, width); // output the result cout << "The area of the rectangle is " << area << endl; return 0; } float promptAndGet(string s) { float value; // prompt for and get the length cout << s; cin >> value; return value; } float computeArea(float value1, float value2) { return value1 * value2; }