#include <iostream>
using namespace std;
class V
{
public:
void a();
void b();
void c();
void show();
public:
float l;
float w;
float h;
float v;
float s;
};
void V::a()
{
cout<<"请输入长,宽,高:";
cin>>l;
cin>>w;
cin>>h;
}
void V::b()
{
v=l*w*h;
}
void V::c()
{
s=2*(l*w+l*h+w*h);
}
void V::show()
{
cout<<"体积:"<<v<<"表面积:"<<s<<endl;
}
int main()
{
V t1,t2,t3;
t1.a();
t1.b();
t1.c();
t1.show();
t2.a();
t2.b();
t2.c();
t2.show();
t3.a();
t3.b();
t3.c();
t3.show();
return 0;
}


被折叠的 条评论
为什么被折叠?



