在已有的Point類的基礎上,定義一個“Circle”派生類,要求:新增一個半徑成員;能計
算並輸出圓的周長及加圓面積
#ifndef __Dervide_circle__circle__ #define __Dervide_circle__circle__ #includeusing namespace std; #define PI 3.1415926 class point { private: float x,y; public: point(void) {x=0;y=0;} point(float a,float b) {x=a ; y=b; } point(const point &ob) {x=ob.x;y=ob.y;} void set_point(float a,float b); float read_x(void); float read_y(void); float read_x(void) const; float read_y(void) const; void move(float a,float b); void move(float a,float b) const; }; class circle :public point { public: circle(float a ,float b ,float c):point(a,b) {r = c;} void set_r(float a){r = a;} float Get_R(){return r;} void circumference(); void squire(); private: float r; }; void point::set_point(float a,float b) {x=a ; y=b; } float point::read_x(void) { return x;} float point::read_y(void) { return y;} void point::move (float a,float b) { x+=a;y+=b;} float point::read_x(void) const { return x;} float point::read_y(void) const { return y;} //void point::move (float a,float b) const // { x+=a;y+=b;} void circle::circumference() { float c = 2*PI*r; cout<<"周長="<
#include"circle.h" int main() { circle C(1.2,2.0,3.0); cout<