您的位置:首页 > 其它

第三单元作业 3.23

2015-04-01 18:42 330 查看
#include<iostream>
using namespace std;
class Cylinder
{
public:
Cylinder(double r,double h);
void vol()
{
cout<<"圆柱体的体积:"<<v<<endl;
}

void get()
{
v=3.14*radius*radius*high;

}
private:
double radius;
double high;
double v;
};

Cylinder::Cylinder(double r,double h)
{
radius=r;
high=h;
}

int main()
{
Cylinder cyl1(6.0,5.0);
cyl1.get();
cyl1.vol();
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: