【计算机类职业资格】全国计算机等级考试二级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+类知识的一个综合考核。对虚函数的定义格式及继承类构造函数的定义格式请多加注意。

展开阅读全文
相关资源
猜你喜欢
  • BS EN 16168-2012 Sludge treated biowaste and soil Determination of total nitrogen using dry combustion method《污泥 处理过的生物废弃物和土壤 利用干式燃烧法进行总氮量的测定》.pdf BS EN 16168-2012 Sludge treated biowaste and soil Determination of total nitrogen using dry combustion method《污泥 处理过的生物废弃物和土壤 利用干式燃烧法进行总氮量的测定》.pdf
  • BS EN 16169-2012 Sludge treated biowaste and soil Determination of Kjeldahl nitrogen《污泥 处理过的生物废弃物和土壤 凯达尔氮的测定》.pdf BS EN 16169-2012 Sludge treated biowaste and soil Determination of Kjeldahl nitrogen《污泥 处理过的生物废弃物和土壤 凯达尔氮的测定》.pdf
  • BS EN 16170-2016 Sludge treated biowaste and soil Determination of elements using inductively coupled plasma optical emission spectrometry (ICP-OES)《污泥 经处理生物废弃物和土壤 采用电感耦合等离子体发射光谱法(.pdf BS EN 16170-2016 Sludge treated biowaste and soil Determination of elements using inductively coupled plasma optical emission spectrometry (ICP-OES)《污泥 经处理生物废弃物和土壤 采用电感耦合等离子体发射光谱法(.pdf
  • BS EN 16171-2016 Sludge treated biowaste and soil Determination of elements using inductively coupled plasma mass spectrometry (ICP-MS)《污泥 经处理生物废弃物和土壤 采用电感耦合等离子体质谱法(ICP-MS)测定元素》.pdf BS EN 16171-2016 Sludge treated biowaste and soil Determination of elements using inductively coupled plasma mass spectrometry (ICP-MS)《污泥 经处理生物废弃物和土壤 采用电感耦合等离子体质谱法(ICP-MS)测定元素》.pdf
  • BS EN 16173-2012 Sludge treated biowaste and soil Digestion of nitric acid soluble fractions of elements《污泥 经处理生物废弃物和土壤 元素硝酸可溶解部分的消化》.pdf BS EN 16173-2012 Sludge treated biowaste and soil Digestion of nitric acid soluble fractions of elements《污泥 经处理生物废弃物和土壤 元素硝酸可溶解部分的消化》.pdf
  • BS EN 16174-2012 Sludge treated biowaste and soil Digestion of aqua regia soluble fractions of elements《污泥 处理过的生物废弃物和土壤 溶解于王水的痕量元素萃取》.pdf BS EN 16174-2012 Sludge treated biowaste and soil Digestion of aqua regia soluble fractions of elements《污泥 处理过的生物废弃物和土壤 溶解于王水的痕量元素萃取》.pdf
  • BS EN 16175-1-2016 Sludge treated biowaste and soil Determination of mercury Cold-vapour atomic absorption spectrometry (CV-AAS)《污泥 经处理生物废弃物和土壤 汞的测定 冷蒸气原子吸收光谱法(CV-AAS)》.pdf BS EN 16175-1-2016 Sludge treated biowaste and soil Determination of mercury Cold-vapour atomic absorption spectrometry (CV-AAS)《污泥 经处理生物废弃物和土壤 汞的测定 冷蒸气原子吸收光谱法(CV-AAS)》.pdf
  • BS EN 16175-2-2016 Sludge treated biowaste and soil Determination of mercury Cold-vapour atomic fluorescence spectrometry (CV-AFS)《污泥 经处理生物废弃物和土壤汞的测定 冷蒸汽原子荧光光谱法(CV-AFS)》.pdf BS EN 16175-2-2016 Sludge treated biowaste and soil Determination of mercury Cold-vapour atomic fluorescence spectrometry (CV-AFS)《污泥 经处理生物废弃物和土壤汞的测定 冷蒸汽原子荧光光谱法(CV-AFS)》.pdf
  • BS EN 16179-2012 Sludge treated biowaste and soil Guidance for sample pretreatment《污泥 经处理生物废弃物和土壤 样品预处理指南》.pdf BS EN 16179-2012 Sludge treated biowaste and soil Guidance for sample pretreatment《污泥 经处理生物废弃物和土壤 样品预处理指南》.pdf
  • 相关搜索

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

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