In the following example, the definition of the
box_car_volume
function appears in a complete program:
#include// Define box_car_volume first: int box_car_volume (int h, int w, int l) { return h * w * l; } // Then, define main: main ( ) { int height = 11, width = 9, length = 40, stretch = 10; cout << "The volume of the standard box car is " << box_car_volume (height, width, length) << endl << "The volume of a stretched box car is " << box_car_volume (height, width, length + stretch) << endl; } --- Result --- The volume of the standard box car is 3960 The volume of a stretched box car is 4950