[计算机类试卷]国家二级C++机试(操作题)模拟试卷352及答案与解析.doc

上传人:sofeeling205 文档编号:497435 上传时间:2018-11-28 格式:DOC 页数:5 大小:30KB
下载 相关 举报
[计算机类试卷]国家二级C++机试(操作题)模拟试卷352及答案与解析.doc_第1页
第1页 / 共5页
[计算机类试卷]国家二级C++机试(操作题)模拟试卷352及答案与解析.doc_第2页
第2页 / 共5页
[计算机类试卷]国家二级C++机试(操作题)模拟试卷352及答案与解析.doc_第3页
第3页 / 共5页
[计算机类试卷]国家二级C++机试(操作题)模拟试卷352及答案与解析.doc_第4页
第4页 / 共5页
[计算机类试卷]国家二级C++机试(操作题)模拟试卷352及答案与解析.doc_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

1、国家二级 C+机试(操作题)模拟试卷 352及答案与解析 一、基本操作题 1 使用 VC6打开考生文件夹下的源程序文件 modil cpp,但该程序运行时有错,请改正程序中的链误,使程序输出的结果为: Number=7 Number=12 注意:错误的语句在 *error*的下面,修改该语句即可。 #include class CMyClass public: *error* CMyClass(int i): Number=i *error* return Number; void Set(int i) Number=i; void display() coutdi splay(); P一 s

2、et(12); P一 display(); return; 二、简单应用题 2 使用 VC6打开考生文件夹下的源程序文件 modi2 cpp。阅读下列函数说明和代码。函数 func(intd, int n)的功能是将长度为 num的数组 d的每一个数字是奇数的扩大 1倍,并存储到数组 d中。 例如: 1 2 3 4 5 6 7 8 9 返回: 2 2 6 4 l 0 6 14 8 18 将 func(int d, int num)补充完整。 注意:请勿改动主函数。 #include void func(int d, int num) int main() int Data=1, 2, 3, 4

3、 5, 6, 7, 8, 9); func(Data, 9); for(int i=0; i using namespace std; C1ass TestClass public: *1* X=a; Y=b; Z=c; *4* void Display() cout“The poi nt i s (“X, Y, Z) end1; cout“The re are ” count “point obj ect s ” endl; private: *2* *3* ; int TestClass: count=0; int main() TestClas s pl(1, 1, 1), p2(1,

4、 2, 3), p3(0, 0, 0); p1 mi splay(); p2 Di splay(); P3 Di splay(); return 0; 国家二级 C+机试(操作题)模拟试卷 352答案与解析 一、基本操作题 1 【正确答案】 (1)CMyClass(int i): Number(i) (2)应删除: return Number; (3)CMyClass*P=new CMyClasS(7); 【试题解析】 CMyClass类含有成员变量 Number和多个成员函数, set(int i)函数可改变成员变量的值, display()函数在屏幕上打印成员变量的值。 二、简单应用题 2

5、 【正确答案】 for(int i=0; inum; i+) if(di 2 1=0) di=2 di; 【试题解析】 函数 func(int d, int n)功能是将长度为 num的数组 d的每一个数字是奇数的扩大 1倍,并存储到数组 d中,因此可利用循环来查找该数组,如果该元素为奇数则变为原来的两倍。 三、综合应用题 3 【正确答案】 (1)添加语句: Testclas s(int a=0, int b=0, int c=0) (2)添加语句: int x, y, z; (3)添加语句: static int count; (4)添加语句: count+; 【试题解析】 本题的功能是设置点,并将点的坐标值显示在屏幕上。在 VC环境下打开程序,根据题干给出的几条功能要求,对程序中给出注释下的内容逐个补全或修改。从己定源程序的 main主函数开始入手,可以看出程序通过调用类TestClass和成员函数实现各种输出操作。

展开阅读全文
相关资源
猜你喜欢
  • BS PD IEC TS 62763-2013_5284 Pilot function through a control pilot circuit using PWM (pulse width modulation) and a control pilot wire《通过控制导向线使用PWM (脉冲宽度调制) 的导向功能和控制导向线》.pdf BS PD IEC TS 62763-2013_5284 Pilot function through a control pilot circuit using PWM (pulse width modulation) and a control pilot wire《通过控制导向线使用PWM (脉冲宽度调制) 的导向功能和控制导向线》.pdf
  • BS ISO 8070-2007 Milk and milk products - Determination of calcium sodium potassium and magnesium contents - Atomic absorption spectrometric method《牛奶和奶制品 钙、钠、钾和镁含量的测定 原子吸.pdf BS ISO 8070-2007 Milk and milk products - Determination of calcium sodium potassium and magnesium contents - Atomic absorption spectrometric method《牛奶和奶制品 钙、钠、钾和镁含量的测定 原子吸.pdf
  • BS ISO 8082-1-2009 Self-propelled machinery for forestry - Laboratory tests and performance requirements for roll-over protective structures - General machines《林业用自推进机械 防倾.pdf BS ISO 8082-1-2009 Self-propelled machinery for forestry - Laboratory tests and performance requirements for roll-over protective structures - General machines《林业用自推进机械 防倾.pdf
  • BS ISO 8082-2-2011 Self-propelled machinery for forestry Laboratory tests and performance requirements for roll-over protective structures Machines having a rotating platf.pdf BS ISO 8082-2-2011 Self-propelled machinery for forestry Laboratory tests and performance requirements for roll-over protective structures Machines having a rotating platf.pdf
  • BS ISO 8083-2006 Machinery for forestry - Falling-object protective structures (FOPS) - Laboratory tests and performance requirements《林业机械 落体防护装置(FOPS) 实验室试验和性能要求》.pdf BS ISO 8083-2006 Machinery for forestry - Falling-object protective structures (FOPS) - Laboratory tests and performance requirements《林业机械 落体防护装置(FOPS) 实验室试验和性能要求》.pdf
  • BS ISO 8086-2004 Dairy plant - Hygiene conditions - General guidance on inspection and sampling procedures《乳品厂 卫生条件 检验和取样程序通用指南》.pdf BS ISO 8086-2004 Dairy plant - Hygiene conditions - General guidance on inspection and sampling procedures《乳品厂 卫生条件 检验和取样程序通用指南》.pdf
  • BS ISO 8096-2005 Rubber- or plastics-coated fabrics for water resistant clothing - Specification《雨衣用橡胶或塑料涂覆织物 规范》.pdf BS ISO 8096-2005 Rubber- or plastics-coated fabrics for water resistant clothing - Specification《雨衣用橡胶或塑料涂覆织物 规范》.pdf
  • BS ISO 8097-2001 Aircraft Minimum airworthiness requirements and test conditions for certified air cargo unit load devices《航空器 经认证的航空货运集装单元装置最低适航性要求和试验条件》.pdf BS ISO 8097-2001 Aircraft Minimum airworthiness requirements and test conditions for certified air cargo unit load devices《航空器 经认证的航空货运集装单元装置最低适航性要求和试验条件》.pdf
  • BS ISO 8114-1993 Textile machinery and accessories - Spindles for ring-spinning and doubling machines - List of equivalent terms《纺织机械和附件 环锭纺纱机和并线机用锭子 同义术语表》.pdf BS ISO 8114-1993 Textile machinery and accessories - Spindles for ring-spinning and doubling machines - List of equivalent terms《纺织机械和附件 环锭纺纱机和并线机用锭子 同义术语表》.pdf
  • 相关搜索

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

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