#include <iostream>
using namespace std;
class chang
{
public:
void volume();
void areas();
void display();
private:
float length;
float width;
float heigth;
float t;
float b;
};
chang s1,s2,s3;
int main()
{
s1.volume();
s1.areas();
s1.display();
s2.volume();
s2.areas();
s2.display();
s3.volume();
s3.areas();
s3.display();
return 0;
}
void chang::volume()
{
cout << "请输入长 宽 高" << endl;
cin>>length>>width>>heigth;
t=length*width*heigth;
}
void chang::areas()
{
b=length*width+width*heigth+length*heigth;
}
void chang::display()
{
cout <<"volume:"<<t<<endl<<"areas:"<<b<<endl;
}
![](http://hi.csdn.net/attachment/201203/12/0_13315470069yEy.gif)