The following program computes the volume of a box car:
#includemain ( ) { cout << "The volume of the box car is " << 11 * 9 * 40 << endl; }
Of course, if you propose to compute the volumes of many box
cars, of varying length, you certainly should define a
volume-computing function, perhaps named box_car_volume
,
to do the work:
#include// Definition of box_car_volume function will go here main ( ) { cout << "The volume of the box car is " << box_car_volume (11, 9, 40) << endl; }
In this example, the box_car_volume
function has three
arguments
11
, 9
, and 40
. As
illustrated, C++ requires function arguments to be separated by
commas.