声明点类Point,包含成员变量的输入和输出功能,由类Point派生出Circle(圆形)类,实现求圆面积的功能 ,由Circle(圆形)类派生出Cylinder(圆柱体)类,具有圆柱体体积的功能,最后编写main函数使用这些类。
声明点类Point,包含成员变量的输入和输出功能,由类Point派生出Circle(圆形)类,实现求圆面积的功能 ,由Circle(圆形)类派生出Cylinder(圆柱体)类,具有圆柱体体积的功能,最后编写main函数使用这些类。
10 20
314.00
6280.00
#include <iostream> #include <iomanip> using namespace std;//声明类Point class Point { public: Point(double a=0,double b=0) { x=a; y=b; } protected: double x,y; }; class Circle : public Point //从Point类派生出来圆类和圆柱体类 { //pdsu-c1 //pdsu-c1 }; class Cylinder:public Circle { //pdsu-c2 //pdsu-c2 }; int main() { double r,h; cin>>r>>h; Cylinder cy1(0,0,r,h); //pdsu-c3 //pdsu-c3 }
Anything about this OnlineJudge, Please Contact Administrator. Click add QQ
OJ system based on HUSTOJ Project , UI based on Twitter Bootstrap
Copyright 2016 ACM算法攻关部cnt: 35542
关于网站改版