【计算机类职业资格】国家二级C++机试(操作题)-试卷166及答案解析.doc

上传人:刘芸 文档编号:1331740 上传时间:2019-10-17 格式:DOC 页数:3 大小:32KB
下载 相关 举报
【计算机类职业资格】国家二级C++机试(操作题)-试卷166及答案解析.doc_第1页
第1页 / 共3页
【计算机类职业资格】国家二级C++机试(操作题)-试卷166及答案解析.doc_第2页
第2页 / 共3页
【计算机类职业资格】国家二级C++机试(操作题)-试卷166及答案解析.doc_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
资源描述

1、国家二级 C+机试(操作题)-试卷 166 及答案解析(总分:6.00,做题时间:90 分钟)一、基本操作题(总题数:1,分数:2.00)1.使用 VC6 打开考生文件夹下的源程序文件 modilcpp,该程序运行时有错,请改正其中的错误,使程序正常运行,并且使程序输出的结果为: a=7,b=0 a=8,b=10 注意:错误的语句在*error*的下面,修改该语句即可。 #include class cobj public: *error* friend void func(CObj&,int,int); void display() *error* coutradius=radius;) d

2、ouble GetArea() *3* double GetGirth() *4* void setRadius(int m) radius=m; ; int main() CCircle Circle(5);coutradius=radius;) double GetArea() *3* double GetGirth() *4* void setRadius(int m) radius=m; ; int main() CCircle Circle(5);cout_正确答案:(正确答案:(1)添加语句:const double PI; (2)将“CCircle(int radius)”补充完

3、整为: CCircle(int radius)PI(CONSTPI) (3)添加语句:return radius*radius*PI; (4)添加语句:return 2*radius*PI;)解析:解析:(1)第 1 个标识下定义私有常量 PI,常数据成员是使用 const 说明的数据成员,因此第 1 个标识下应添加“constdouble PI;”0 (2)常数据成员的初始化只能通过构造函数的成员初始化列表进行,构造函数 CCircle(int radius)应对常数据成员 PI 进行初始化,第 2 个标识下应改为“CCircle(int radius):PI(CONST_PI)”。 (3)第 3 个标识下返回圆面积值,圆面积为半径平方与 PI 的乘积值,即第 3标识下应添加“return radius*radius*PI;yI。 (4)第 4 个标识下返回周长,即第 4 表示下应添加“return2*radius*PI;”。

展开阅读全文
相关资源
猜你喜欢
  • BS 6997-1990 Specification for elastomeric toroidal sealing rings (O-rings) manufactured from acrylonitrile-butadiene rubbers complying with BS 6996《使用BS 6996丁腈橡胶制成的橡胶环形密封圈(O形圈)规范》.pdf BS 6997-1990 Specification for elastomeric toroidal sealing rings (O-rings) manufactured from acrylonitrile-butadiene rubbers complying with BS 6996《使用BS 6996丁腈橡胶制成的橡胶环形密封圈(O形圈)规范》.pdf
  • BS 6999-1989 Specification for vitreous-enamelled low-carbon-steel flue pipes other components and accessories for solid-fuel-burning appliances with a rated output of 45 kW《额定输出功率.pdf BS 6999-1989 Specification for vitreous-enamelled low-carbon-steel flue pipes other components and accessories for solid-fuel-burning appliances with a rated output of 45 kW《额定输出功率.pdf
  • BS 6F 100-1998 Procedure for inspection and testing of textiles for aerospace purposes《航空航天用织物检验和试验规程》.pdf BS 6F 100-1998 Procedure for inspection and testing of textiles for aerospace purposes《航空航天用织物检验和试验规程》.pdf
  • BS 6F 37-1990 Specification for 570 g m2 and 640 g m2 cotton canvas fabrics for aerospace purposes《航空航天用570g m m和 640g m m棉粗帆布纤维规范》.pdf BS 6F 37-1990 Specification for 570 g m2 and 640 g m2 cotton canvas fabrics for aerospace purposes《航空航天用570g m m和 640g m m棉粗帆布纤维规范》.pdf
  • BS 6F 49-2007 Specification for shuttle woven cotton webbing for aerospace purposes《航空航天用梭编织棉网规范》.pdf BS 6F 49-2007 Specification for shuttle woven cotton webbing for aerospace purposes《航空航天用梭编织棉网规范》.pdf
  • BS 6F 55-1991 Specification for 345 g m2 and 415 g m2 cotton canvas fabrics suitable for aerospace purposes《航空航天用345g m m和415g m m棉粗帆布规范》.pdf BS 6F 55-1991 Specification for 345 g m2 and 415 g m2 cotton canvas fabrics suitable for aerospace purposes《航空航天用345g m m和415g m m棉粗帆布规范》.pdf
  • BS 6L 16-1985 Specification for sheet and strip of 99% aluminium (temper designation H14 or H24)《99%铝板材和带材规范(强度符号-H14或H24)》.pdf BS 6L 16-1985 Specification for sheet and strip of 99% aluminium (temper designation H14 or H24)《99%铝板材和带材规范(强度符号-H14或H24)》.pdf
  • BS 6L 17-1985 Specification for sheet and strip of 99% aluminium (temper designation-O)《99%铝板材和带材规范(强度符号-0)》.pdf BS 6L 17-1985 Specification for sheet and strip of 99% aluminium (temper designation-O)《99%铝板材和带材规范(强度符号-0)》.pdf
  • BS 6S 100-2010 Aerospace series - Procedure for inspection testing and acceptance of wrought steels (other than plate sheet strip and tube)《航空航天系列 锻钢的检验、试验和验收规程》.pdf BS 6S 100-2010 Aerospace series - Procedure for inspection testing and acceptance of wrought steels (other than plate sheet strip and tube)《航空航天系列 锻钢的检验、试验和验收规程》.pdf
  • 相关搜索

    当前位置:首页 > 考试资料 > 职业资格

    copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
    备案/许可证编号:苏ICP备17064731号-1