Thus, the following program computes box-car
volumes as long as you type numbers; it stops when you type the
control-d
keychord.
#includedouble box_volume (double h, double w, double l) {return h * w * l;} main ( ) { double height, width, depth; while (cin >> height >> width >> depth) cout << "The volume of a " << height << " by " << width << " by " << depth << " box car is " << box_volume (height, width, depth) << endl; cout << "You appear to have finished." << endl; } --- Data --- 10.5 9.5 40.0 10.5 9.5 50.0 --- Result --- The volume of a 10.5 by 9.5 by 40 box car is 3990 The volume of a 10.5 by 9.5 by 50 box car is 4987.5 You appear to have finished.