#include<iostream>
using namespace std;
class Bulk
{
private:
double length;
double width;
double height;
double area;
double volume;
public:
Bulk(double x=1,double y=1,double z=1);
void get_value();
void caculate_area();
void caculate_volume();
void output();
};
Bulk::Bulk(double x,double y,double z)
{
length=x;
width=y;
height=z;
}
void Bulk::get_value()
{
double a,b,c;
cin>>a>>b>>c;
length=a;
width=b;
height=c;
}
void Bulk::caculate_area()
{
area=(2*(length*width+length*height+width*height));
}
void Bulk::caculate_volume()
{
volume=length*width*height;
}
void Bulk::output()
{
cout<<"表面积为"<<area<<endl;
cout<<"体积为"<<volume<<endl<<endl;
}
int main()
{
Bulk b[5]= {Bulk(2.3,4.5,6.7),Bulk(1.5,3.4),Bulk(10.5)};
b[4].get_value();
int i;
for(i=0;i<5;i++)
{
b[i].caculate_area();
b[i].caculate_volume();
}
for(i=0; i<5; i++)
{
cout<<"第"<<i<<"个长方体的"<<endl;
b[i].output();
}
return 0;
}