You can, for example, define one display_box_car_volume
function that handles integers, and another
display_box_car_volume
function that handles
floating-point numbers:
// Define integer display_box_car_volume function: void display_box_car_volume (int h, int w, int l) { cout << "The integer volume of the box car is " << h * w * l << endl; }
// Then, define floating-point display_box_car_volume function: void display_box_car_volume (double h, double w, double l) { cout << "The floating-point volume of the box car is " << h * w * l << endl; }
Then, you can put both functions to work in the same program:
#include// Define integer display_box_car_volume function here // Define floating-point display_box_car_volume function here // Then, define main: main ( ) { int int_height = 11, int_width = 9, int_length = 40; double double_height = 10.5, double_width = 9.5, double_length = 40.0; display_box_car_volume (int_height, int_width, int_length); display_box_car_volume (double_height, double_width, double_length); } --- Result --- The integer volume of the box car is 3960 The floating-point volume of the box car is 3990