#include<iostream>
using namespace std;
class cylinder
{
private:
double radius;
double high;
public:
cylinder(double r,double h)
{radius=r;
high=h;
}
double vol()
{
return 3.14*radius*radius*high;
}
void show_vol()
{cout<<"该圆柱的体积为:"<<vol()<<endl;
}
};
int main()
{
cylinder v1(4,5);
v1.vol();
v1.show_vol();
return 0;
}
作业3.23
最新推荐文章于 2024-03-21 15:31:37 发布