/* This program asks the user to enter in the 3 dimensions of a box (i.e. the lengths of the sides) and then computes the area and volume of the box. This is accomplished by calling a single function to compute both the area and the volume. The area and volume variables are passed by reference. Note the special syntax of the function declaration and definition. The function call, on the other hand, looks the same as in the case of passing by value. */ #include void box_area_vol (double, double, double, double&, double&); void main() { double side1, side2, side3, a, v; cout << "Enter the dimensions of the box (3 positive real numbers): "; cin >> side1 >> side2 >> side3; box_area_vol(side1,side2,side3,a,v); cout << "The area of the box is " << a << ".\n"; cout << "The volume of the box is " << v << ".\n"; } void box_area_vol (double x, double y, double z, double& area, double& volume) { area = 2*x*y + 2*y*z + 2*z*x; volume = x*y*z; }