皮皮学,免费搜题
登录
logo - 刷刷题
搜题
【简答题】
阅读以下说明和C++程序,将入(n)处的字句写在答题纸的对应栏内。 说明 以下程序的功能是计算三角形、矩形和正方形的面积并输出。 4个类组成:类Triangle、Rectangle和Square分别表示三角形、矩形和正方形;抽象类Figure提供了一个纯虚拟函数getArea(),作为计算上述三种图形面积的通用接口。 c++程序 include <iostream.h> inclule <math.h> class Figure { public: virtual double getArea()= 0; // 纯虚拟函数 }; class Rectangle: (1) { protected: double height; double width; public: Rectangle() { }; Rectangle(double height, double width) { this->height = height; this->width = width; } double getArea() { return (2) ; } class Square: (3) { public: Square(double width) { (4) ; } }; class Triangle: (5) { double la; double lb; double lc; public: Triangle(double la, double lb, double lc) { this->la = la; this->lb ='lb; this->lc = lc; } double getArea() { double s = (la+lb+lc)/2.0; return sqrt(s*(s-la)*(s-lb)*(s-lc)); } }; void main() { Figure* figures[3] = { new Triangle(2,3,3), new Rectangle(5,8), new Square(5)}; for (int i = 0; i < 3; i++) { com << 'figures[' << i << '] area =' << (figures[i])->getArea0 << endl; }
手机使用
分享
复制链接
新浪微博
分享QQ
微信扫一扫
微信内点击右上角“…”即可分享
反馈
参考答案:
举一反三
【简答题】We believe there is a promising market in our area ___moderately priced goods.
【单选题】下列选项中不属于期间费用的是( )。
A.
管理费用
B.
财务费用
C.
销售费用
D.
制造费用
【判断题】布尔巴基学派认为“数学是研究现实世界的空间形式和数量关系的科学。()
A.
正确
B.
错误
【简答题】We believe that there is ample scope___the development of business with China.
【单选题】数学研究所建立的各种计算方法和工具使得科学研究和现在一般意义上的哲学研究开始_______,而科学研究的定量化又使得科学研究的成果能够得到实际应用,定量化正是科学和哲学彻底分离的最显著标志。 填入划横线部分最恰当的一项是:
A.
各有怀抱
B.
各自为政
C.
分道扬镳
D.
分庭抗礼
【单选题】We believe there is a market in our area for moderately priced goods of the kind mentioned above.
A.
promised
B.
promising
C.
promise
D.
promoting
【简答题】数学是研究 和 的一门学科; 性、 性和 性是数学的三大特征;数学的基本思想是指 思想、 思想、 思想。
【单选题】未请假或者请假逾期( )周以上的未报到入学,除因不可抗力等正当事由以外,视为放弃入学资格。
A.
1
B.
2.
C.
3
D.
4
【简答题】We believe there is a promising market in our area for moderately priced goods of the kind mentioned.
【多选题】下列关于 亚硝酸盐 中毒症状 ,描述正确的是 ( )。
A.
严重者呼吸困难、昏迷、抽搐
B.
抢救 的最佳时间 一般在食后 0.5h
C.
可在2h内死亡
D.
死后尸斑呈蓝褐色
E.
血液呈酱油色,不凝固
相关题目:
参考解析:
知识点:
题目纠错 0
发布
创建自己的小题库 - 刷刷题