#include <iostream>
using std::cout;
using std::endl;
class Box {
public:
Box(double _length, double _width = 1.0, double _height = 1.0) :
length(_length),
width(_width),
height(_height)
{}
Box() {
length = width = height = 1.0;
}
void Print()
{
cout << length << " " << width << " " << height << endl;
}
double Volume() const
{
return length * width * height;
}
private:
double length;
double width;
double height;
};
int main()
{
Box arr[3]
{
Box(1, 2, 3),
Box(2, 4, 6),
Box(1.2, 3.5, 6.7)
};
arr[0].Print();
arr[1].Print();
arr[2].Print();
cout << arr[0].Volume() << endl;
cout << arr[1].Volume() << endl;
cout << arr[2].Volume() << endl;
return 0;
}
/*
run:
1 2 3
2 4 6
1.2 3.5 6.7
6
48
28.14
*/