⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cylinder.cpp

📁 继承与派生实验
💻 CPP
字号:
#include<iostream.h>
#include"cylinder.h"
#include<math.h>                                   //引用数学库函数
const double pi=3.14159;                           //定义常数圆周率
void cylinder::area()                              //调用计算圆柱面积的函数计算圆柱的表面积
{
	Area=2*pi*pow(radius,2)+2*pi*radius*height;
}
void cylinder::volumn()                             //调用计算圆柱体积的函数计算圆柱的体积
{
	Volumn=pi*pow(radius,2)*height;
}
void cylinder::show ()                              //调用输出函数输出圆柱的表面积和体积
{
	cout<<" \n 圆柱的表面积是:"<<Area<<endl;
	cout<<" 圆柱的体积是:  "<<Volumn<<endl;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -