..
{
cout<<\圆柱的体积为:\ }
private:
double sur; //表面积 double vol; //体积 double height; //高 }; //圆锥
class cone:public circle {
public:
void in_rad() {
cout<<\输入圆锥半径:\ cin>>rad; }
void in_height() {
cout<<\输入圆锥高:\ cin>>height; }
void calc_sur() {
sur=0.5*PI*rad*rad*2*PI*rad*height; }
void calc_vol() {
vol=1/3.0*PI*rad*rad*height; }
void out_sur() {
cout<<\圆锥的表面积为:\ }
void out_vol() {
cout<<\圆锥的体积为:\ }
private:
double sur; //表面积 double vol; //体积 double height; };
int main()
c
..
{
cout<<\球:\ ball oball; oball.in_rad(); oball.calc_sur(); oball.calc_vol(); oball.out_sur(); oball.out_vol(); cout< cout<<\圆柱:\ column ocol; ocol.in_rad(); ocol.in_height(); ocol.calc_sur(); ocol.calc_vol(); ocol.out_sur(); ocol.out_vol(); cout< cout<<\圆锥:\ cone ocone; ocone.in_rad(); ocone.in_height(); ocone.calc_sur(); ocone.calc_vol(); ocone.out_sur(); ocone.out_vol(); cout< 运行结果: . . c