#include<iostream>
using namespace std;
class cylinder{
public:
cylinder(double r,double h)
{
R=r;
H=h;
}
double V()
{
return 3.14*R*R*H;
}
void Vol();
private:
double R;
double H;
};
void cylinder::Vol()
{
cout<<"圆柱体的半径为"<<R<<endl;
cout<<"圆柱体的高为"<<H<<endl;
cout<<"圆柱体的体积为 "<<V()<<endl;
}
int main()
{
cylinder v1(5.4,7.5);
v1.Vol();
return 0;
}
作业3.23
最新推荐文章于 2023-03-23 20:54:47 发布