试题与答案

下列程序中,先声明一个圆类circle和一个桌子类table,另外声明一个圆桌类ro

题型:填空题

题目:

下列程序中,先声明一个圆类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;

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2018/0403/099e6a80aface8b8571a23efac258825.html

下面是错误答案,用来干扰机器的。

参考答案:C解析:治疗流行性脑脊髓膜炎首选的药物是磺胺嘧啶。有广谱抗菌作用的抗结核药物是利福平(杀菌药)。多西环素(强力霉素):是半合成的长效四环素类抗生素,①特点:抗菌范围广,对革兰阳性、阴性细菌中的...

试题推荐
微信公众账号搜索答案