#include <iostream>
using namespace std;
class BULK
{
public:
BULK(double a=1.0,double b=1.0,double c=1.0):length(a),width(b),heigth(c){}
void getvalue();
void bmj();
void tiji();
private:
double length,width,heigth;
};
void BULK::getvalue()
{
cin>>length>>width>>heigth;
}
void BULK::bmj()
{
cout<<(length*width*2+width*heigth*2+heigth*length*2)<<endl;
}
void BULK::tiji()
{
cout<<length*width*heigth<<endl;
}
int main()
{
BULK b[5]={BULK(2.3,4.5,6.7),(1.5,3.4),(10.5)};
b[4].getvalue();
int i=0;
for(i=0;i<5;i++)
{
b[i].bmj();
b[i].tiji();
}
return 0;
}
运行结果: