#include <iostream>
#include <string>
using namespace std;
class Bulk
{
public:
void get_value();
void output();
Bulk(double ,double,double);
private:
double length,width,heigh;
};
Bulk::Bulk(double n=1,double m=1,double k=1)
{
length=n;
width=m;
heigh=k;
}
void Bulk::get_value()
{
cout<<"请输入长 宽 高";
cin>>length>>width>>heigh;
}
void Bulk::output()
{ double s,v;
s=length*width*2+length*heigh*2+width*heigh*2;
v=length*width*heigh;
cout<<"表面积为:"<<s;
cout<<"体积为:"<<v<<endl;
}
int main()
{
int i;
Bulk b[5]={Bulk(2.3,4.5,6.7),Bulk(1.5,3.4),Bulk(10.5)};
b[4].get_value();
for(i=0;i<5;i++)
{
cout<<"第"<<i+1<<"个长方体的:";
b[i].output();
}
return 0;
}