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
|
#include <iostream>
#include <iomanip>
using namespace std;
void box(const double width, const double len, const double ht, double &volume, double &surfacearea);
int main(void)
{
double width, len, ht, volume, surfacearea;
cout << "Enter width, len, ht: ";
cin >> width >> len >> ht;
box(width, len, ht, volume, surfacearea);
cout << fixed << setprecision(3);
cout << "Volume is " << volume << " surface area is " << surfacearea << endl;
return 0;
}
void box(const double width, const double len, const double ht, double &volume, double &surfacearea)
{
volume = width * len * ht;
surfacearea = 2 * width * len + 2 * width * ht + 2 * len * ht;
}
|