📄 6_54.cpp
字号:
#include<iostream.h>
const double pi=3.1415926;
class Column
{
public:
void SetColumn();
double getvolume();
double getsurface();
void disp();
private:
double radius;
double height;
};
void Column::SetColumn()
{
double r,h;
cout<<"Input the radius and height of a column!";
cout<<endl;
cout<<"radius=";
cin>>r;
cout<<"height=";
cin>>h;
radius=r;
height=h;
}
inline double Column::getvolume()
{
return pi*radius*radius*height;
}
inline double Column::getsurface()
{
return 2*pi*radius*(height+radius);
}
void Column::disp()
{
cout<<"The volume of the column is "<<Column::getvolume();
cout<<endl;
cout<<"The surface of the column is "<<Column::getsurface();
cout<<endl;
}
void main()
{
Column mycolumn;
mycolumn.SetColumn();
mycolumn.getvolume();
mycolumn.getsurface();
mycolumn.disp();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -