下列程序中,先声明一个圆类circle和一个桌子类table,另外声明一个圆桌类roundtable,它是由 circle和table两个类派生的,要求声明一个圆桌类对象,并输出圆桌的高度,面积和颜色。请填空完成程序 #include<iostream.h> #include<string.h> class circle{ double radius; public: circle(double r){radius=r;} double get_area(){return 3.416*radius*radius;} }; class table{ double height; public: table(double h)<height=h;} double get_height(){return height;} }; class roundtable:public table,public circle{ char *color; public: roundtable(double h,double r,char c[]): [10] {color=new char[strlen(c) +1]; [11] ; }; char*get_color(){return color;} }: void main(){roundtable rt(0.8,1.0,“白色”);cout<<"圆桌的高:"<<rt. get_height()<<end1;cout<<"圆桌面积:"<<rt.get_area()<<end1;cout<<"圆桌颜色:"<<n.get color()<<end1; }
参考答案:[A0] circle(r), table(h) [AA] strcpy(color, c)