cylinder.cpp
来自「这个是继承与派生的实验」· C++ 代码 · 共 28 行
CPP
28 行
//圆柱.cpp
#include<iostream.h>
#include"cylinder.h"
#include<math.h>
#include<string.h>
const double PI=3.14159;
cylinder::cylinder(double R,double h):circle(R)
{
hight=h;
}
double cylinder::setA(double R,double h) //求面积
{
Area=2*PI*pow(R,2)+2*PI*R*h;
return Area;
}
double cylinder::setV(double R,double h) //求体积
{
Volume=Area*h;
return Volume;
}
void cylinder::print()const
{
cout<<"圆柱的表面积为:"<<Area<<endl;
cout<<"圆柱的体积为:"<<Volume<<endl;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?