1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
#include <iostream>
using namespace std;
double box(double length, double width, double height); // use double data
int main()
{
int i, j, k;
int l, m, n;
int p, q, r;
double sum;
cout << "Enter Box 1(Length, Width, Height): ";
cin >> i >> j >> k;
cout << "Enter Box 2(Length, Width, Height): ";
cin >> l >> m >> n;
cout << "Enter Box 3(Length, Width, Height): ";
cin >> p >> q >> r;
cout << "The sum of the volumes is " << i+j+k+l+m+n+p+q+r << "\n";
cout << "The average volume is " << i+j+k+l+m+n+p+q+r / 3.0 << "\n";
return 0;
}
// This version of box uses double data.
double box(double length, double width, double height)
{
return length * width * height ;
}
|