#include <iostream>
using namespace std;
class Tiji
{
public:
void cin_ ();
void jisuan ();
void cout_num ();
private:
int length;
int width;
int heigth;
int volume;
int ares;
}
;void Tiji::cin_ ()
{
cout<<"请输入长宽高"<<endl;
cin>>length>>width>>heigth;
}
void Tiji::cout_num (void)
{
cout<<"体积为:"<<volume<<endl;
cout<<"表面积为:"<<ares<<endl;
}
void Tiji::jisuan(void)
{
volume=length*width*heigth;
ares=length*width*2+length*heigth*2+width*heigth*2;
}
int main ()
{
Tiji t1,t2,t3;
t1.cin_();
t1.jisuan();
t1.cout_num();
t2.cin_();
t2.jisuan();
t2.cout_num();
t3.cin_();
t3.jisuan();
t3.cout_num();
return 0;
}
T4
最新推荐文章于 2024-08-16 09:11:34 发布