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

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

1、国家二级 C+机试(操作题)-试卷 59 及答案解析(总分:6.00,做题时间:90 分钟)一、基本操作题(总题数:1,分数:2.00)1.使用 VC6 打开考生文件夹下的源程序文件 modilcpp,咀该程序运行时有错,请改正程序中的错误,使程序输出的结果为: Numbe=8 注意:错误的语句在*error*的下面,修改该语句即可。#include class CMyClass public: *error* void Z=c; *4* void Display() coutX , Y , Z) “There are” “point obj ects” _国家二级 C+机试(操作题)-试卷

2、59 答案解析(总分:6.00,做题时间:90 分钟)一、基本操作题(总题数:1,分数:2.00)1.使用 VC6 打开考生文件夹下的源程序文件 modilcpp,咀该程序运行时有错,请改正程序中的错误,使程序输出的结果为: Numbe=8 注意:错误的语句在*error*的下面,修改该语句即可。#include class CMyClass public: *error* void Z=c; *4* void Display() coutX , Y , Z) “There are” “point obj ects” _正确答案:(正确答案:(1)添加语句: Testclass(int a=0

3、int b=0,int c=0 1 (2)添加语句:int x,y,z ; (3)添加语句: static int count; (4)添加语句:courtt+;)解析:解析:本题的功能是设置点,并将点的坐标值显示在屏幕上。在 VC 环境下打开程序,根据题干给出的几条功能要求,对程序中给出注释下的内容逐个补全或修改。从已定源程序的 main 主函数开始入手,可以看出程序通过调用类 TestClass 和成员函数实现各种输出操作。 【解题思路】 (1)题目 1 要求“完成默认构造函数 TestClass 的定义”。构造函数是一种特殊的成员函数,它的名字必须与类同名,所以这里的构造函数名字是 T

4、estClass。根据题目中要求,实现构造函数参数的赋值,即这里添加“TestClass(int a=0,intb=0,int c=0)”。 (2)题目 2 要求“定义类的私有成员变量,X、Y、z 类型为int”。在类 Test Class 中的 prirate 区域,声明变量 X、Y、Z 为整型就可以了,即在第 2 个标识卜添加“int,X,Y,Z;”。 (3)题目 3 要求“定义类 TestC。lass 的数据成员 count 声明为静态整数型数据成员”。同(2)在第 3 个标识下声明 count 为静态整型,即添加“static int count;”。 (4)题目 4 要求“在构造函数中实现用 count 表示类 TestClass 被实现对象的次数”。在构造函数 TestClass 中添加 count 自加运算语句,即在第 4 个标识下添加“count+;”。

展开阅读全文
相关资源
猜你喜欢
  • GOST R 51042-1997 Face belt conveyors Test methods《工作面胶带运输机 测试方法》.pdf GOST R 51042-1997 Face belt conveyors Test methods《工作面胶带运输机 测试方法》.pdf
  • GOST R 51043-2002 Automatic water and foam fire fighting systems Sprinklers spray nozzles and water mist nozzles General technical requirements Test methods《自动供水和泡沫灭火系统 洒水装置、喷雾嘴和水雾.pdf GOST R 51043-2002 Automatic water and foam fire fighting systems Sprinklers spray nozzles and water mist nozzles General technical requirements Test methods《自动供水和泡沫灭火系统 洒水装置、喷雾嘴和水雾.pdf
  • GOST R 51045-2014 Rails of ways technological railways transport General specifications《铁路技术性运输方式用轨道 通用规格》.pdf GOST R 51045-2014 Rails of ways technological railways transport General specifications《铁路技术性运输方式用轨道 通用规格》.pdf
  • GOST R 51046-1997 Fire engineering Generators of extinguishing aerosol Types and basic parameters《防火工程 灭火气溶胶发生器 类型和基本参数》.pdf GOST R 51046-1997 Fire engineering Generators of extinguishing aerosol Types and basic parameters《防火工程 灭火气溶胶发生器 类型和基本参数》.pdf
  • GOST R 51047-1997 Cutters for shearers and entry-driving machines General specifications《刨煤机与掘进机用刀具 通用规范》.pdf GOST R 51047-1997 Cutters for shearers and entry-driving machines General specifications《刨煤机与掘进机用刀具 通用规范》.pdf
  • GOST R 51048-1997 Electromagnetic compatibility of technical equipment Generators of electromagnetic field with TEM cells Technical requirements and test methods《工业设备电磁兼容性 配TEM电池的电.pdf GOST R 51048-1997 Electromagnetic compatibility of technical equipment Generators of electromagnetic field with TEM cells Technical requirements and test methods《工业设备电磁兼容性 配TEM电池的电.pdf
  • GOST R 51049-2008 Fire equipment Pressure fire hoses General technical requirements Test methods《消防设备 压力消防软管 一般技术要求 检测方法》.pdf GOST R 51049-2008 Fire equipment Pressure fire hoses General technical requirements Test methods《消防设备 压力消防软管 一般技术要求 检测方法》.pdf
  • GOST R 51050-1997 Deflection yoke systems Methods of measurement and control of parameters《偏转磁轭系统 参数的测量与控制方法》.pdf GOST R 51050-1997 Deflection yoke systems Methods of measurement and control of parameters《偏转磁轭系统 参数的测量与控制方法》.pdf
  • GOST R 51052-2002 Automatic water and foam fire extinguishing installations Wet and dry systems alarm stations General technical requirements Test methods《自动供水和泡沫灭火装置 潮湿和干燥系统报警站 一般.pdf GOST R 51052-2002 Automatic water and foam fire extinguishing installations Wet and dry systems alarm stations General technical requirements Test methods《自动供水和泡沫灭火装置 潮湿和干燥系统报警站 一般.pdf
  • 相关搜索

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

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