【计算机类职业资格】全国计算机等级考试二级C++上机题库试卷九2013年及答案解析.doc

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

1、全国计算机等级考试二级 C+上机题库试卷九 2013 年及答案解析(总分:3.00,做题时间:90 分钟)1.改错题 使用 VC6 打开考生文件夹下的工程 kt14_1,此工程包含一个源程序文件 kt14_1.cpp,但该程序运行有问题,请改正程序中的错误,使该程序的输出结果为: A:noparameters B:intparameter A:noparameters B:intparameter C:intparameter 源程序文件 kt14_1.cpp 清单如下: #include classA /*found*/ private: A()cout classThreeDCoord:p

2、ublicCoordinate intz; public: ThreeDCoord(inta=0,intb=0,intc=0); virtualvoidDisplay()const; ; /*4* voidThreeDCoord:Display()const cout voidmain() Coordinatec(1,2); ThreeDCoordt(3,4,5); c.Display(); t.Display(); (分数:1.00)_全国计算机等级考试二级 C+上机题库试卷九 2013 年答案解析(总分:3.00,做题时间:90 分钟)1.改错题 使用 VC6 打开考生文件夹下的工程 kt

3、14_1,此工程包含一个源程序文件 kt14_1.cpp,但该程序运行有问题,请改正程序中的错误,使该程序的输出结果为: A:noparameters B:intparameter A:noparameters B:intparameter C:intparameter 源程序文件 kt14_1.cpp 清单如下: #include classA /*found*/ private: A()cout /*从 0n 中找到既能被 3 整除同时又能被 7 整除的数,并将这些数求和*/ if(i%3=0 s=sqrt(s); /*对 s求平方根*/ return s; )解析:本题的解题思路是:逐个

4、取得从 0n 之间的所有数,对每次取得的数进行条件判断,条件是既能被 3 整除同时又能被 7 整除,注意:这两个条件要求同时成立,因此用到了“ /*2* ; Coordinate:Coordinate(inta,intb) /*3* voidCoordinate:Display()const cout classThreeDCoord:publicCoordinate intz; public: ThreeDCoord(inta=0,intb=0,intc=0); virtualvoidDisplay()const; ; /*4* voidThreeDCoord:Display()const

5、cout voidmain() Coordinatec(1,2); ThreeDCoordt(3,4,5); c.Display(); t.Display(); (分数:1.00)_正确答案:(1)protected: int x; int y; (2)virtual void Display() const; (3)x=a; y=b; (4)ThreeDCoord:ThreeDCoord(int a, int b, int c) : Coordinate(a, b)解析:本题主要考查对类数据成员的定义、构造函数、派生类及虚函数的理解,是 C+类知识的一个综合考核。对虚函数的定义格式及继承类构造函数的定义格式请多加注意。

展开阅读全文
相关资源
猜你喜欢
  • DIN EN 1816-2010 Resilient floor coverings - Specification for homogeneous and heterogeneous smooth rubber floor coverings with foam backing German version EN 1816 2010《弹性地板铺覆物 带有背.pdf DIN EN 1816-2010 Resilient floor coverings - Specification for homogeneous and heterogeneous smooth rubber floor coverings with foam backing German version EN 1816 2010《弹性地板铺覆物 带有背.pdf
  • DIN EN 1817-2010 Resilient floor coverings - Specification for homogeneous and heterogeneous smooth rubber floor coverings German version EN 1817 2010《地板弹性铺覆物 均质和非均质平面地板弹性铺覆物规范 德文版.pdf DIN EN 1817-2010 Resilient floor coverings - Specification for homogeneous and heterogeneous smooth rubber floor coverings German version EN 1817 2010《地板弹性铺覆物 均质和非均质平面地板弹性铺覆物规范 德文版.pdf
  • DIN EN 1820-2009 Anaesthetic reservoir bags (ISO 5362 2000 modified) German version EN 1820 2005+A1 2009《麻醉剂储存袋(ISO 5362 2000修改件) 德文版本 EN 1820 2005+A1 2009》.pdf DIN EN 1820-2009 Anaesthetic reservoir bags (ISO 5362 2000 modified) German version EN 1820 2005+A1 2009《麻醉剂储存袋(ISO 5362 2000修改件) 德文版本 EN 1820 2005+A1 2009》.pdf
  • DIN EN 1821-1-1998 Electrically propelled road vehicles - Measurement of road operating ability - Part 1 Pure electric vehicles German version EN 1821-1 1996《电动道路车辆 道路行驶性能的测量 第1部分 .pdf DIN EN 1821-1-1998 Electrically propelled road vehicles - Measurement of road operating ability - Part 1 Pure electric vehicles German version EN 1821-1 1996《电动道路车辆 道路行驶性能的测量 第1部分 .pdf
  • DIN EN 1822-1-2011 High efficiency air filters (EPA HEPA and ULPA) - Part 1 Classification performance testing marking German version EN 1822-1 2009《高效空气滤清器(EPA HEPA和ULPA) 第1部分 分类 .pdf DIN EN 1822-1-2011 High efficiency air filters (EPA HEPA and ULPA) - Part 1 Classification performance testing marking German version EN 1822-1 2009《高效空气滤清器(EPA HEPA和ULPA) 第1部分 分类 .pdf
  • DIN EN 1822-2-2011 High efficiency air filters (EPA HEPA and ULPA) - Part 2 Aerosol production measuring equipment particle counting statistics German version EN 1822-2 2009《高效空气滤清.pdf DIN EN 1822-2-2011 High efficiency air filters (EPA HEPA and ULPA) - Part 2 Aerosol production measuring equipment particle counting statistics German version EN 1822-2 2009《高效空气滤清.pdf
  • DIN EN 1822-3-2011 High efficiency air filters (EPA HEPA and ULPA) - Part 3 Testing flat sheet filter media German version EN 1822-3 2009《高效空气滤清器(EPA HEPA和ULPA) 第3部分 试验扁平片状过滤介质 德文版.pdf DIN EN 1822-3-2011 High efficiency air filters (EPA HEPA and ULPA) - Part 3 Testing flat sheet filter media German version EN 1822-3 2009《高效空气滤清器(EPA HEPA和ULPA) 第3部分 试验扁平片状过滤介质 德文版.pdf
  • DIN EN 1822-4-2011 High efficiency air filters (EPA HEPA and ULPA) - Part 4 Determining leakage of filter elements (scan method) German version EN 1822-4 2009《高效空气过滤器(EPA HEPA和ULPA.pdf DIN EN 1822-4-2011 High efficiency air filters (EPA HEPA and ULPA) - Part 4 Determining leakage of filter elements (scan method) German version EN 1822-4 2009《高效空气过滤器(EPA HEPA和ULPA.pdf
  • DIN EN 1822-5-2011 High efficiency air filters (EPA HEPA and ULPA) - Part 5 Determining the efficiency of filter elements German version EN 1822-5 2009《高效空气滤清器(EPA HEPA和ULPA)- 第5部分.pdf DIN EN 1822-5-2011 High efficiency air filters (EPA HEPA and ULPA) - Part 5 Determining the efficiency of filter elements German version EN 1822-5 2009《高效空气滤清器(EPA HEPA和ULPA)- 第5部分.pdf
  • 相关搜索

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

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