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

上传人:outsidejudge265 文档编号:497448 上传时间:2018-11-28 格式:DOC 页数:6 大小:30KB
下载 相关 举报
[计算机类试卷]国家二级C++机试(操作题)模拟试卷364及答案与解析.doc_第1页
第1页 / 共6页
[计算机类试卷]国家二级C++机试(操作题)模拟试卷364及答案与解析.doc_第2页
第2页 / 共6页
[计算机类试卷]国家二级C++机试(操作题)模拟试卷364及答案与解析.doc_第3页
第3页 / 共6页
[计算机类试卷]国家二级C++机试(操作题)模拟试卷364及答案与解析.doc_第4页
第4页 / 共6页
[计算机类试卷]国家二级C++机试(操作题)模拟试卷364及答案与解析.doc_第5页
第5页 / 共6页
点击查看更多>>
资源描述

1、国家二级 C+机试(操作题)模拟试卷 364及答案与解析 一、基本操作题 1 使用 VC6打开考生文件夹下的源程序文件 modil cpp,该程序运行时有错,请改正其中的错误,使程序正常运行,并使程序输出的结果为: Max is 7 提示: max()函数实现找出两个数中的最大值,并作为函数值返回。 注意:错误的语句在 *error*的下面,修改该语句即可。 #include using namespace std; *error* int max(int a, int b) if(a void fun(double b, int fen) Void main() double b1 2 8;

2、 fun(b, 1 2 8); for(int i=0; i #include Class CStudentID *1*定义私有数据成员 public: *2*定义默认构造函数 IDvalue=id; cout0)最小值位置 b0=0; 赋值第一个元素 if(1en1) b1=1; 赋值第二个元素 for(int i=2; i1en; i+) bi=bi一 1+bi一 2;将两个元素之和赋予当前元素 【试题解析】 根据题干中给出的要求,从已给部分源程序的 main主函数开始入手,补全函数 voidfun(double b, int len)。 三、综合应用题 3 【正确答案】 (1)添加语句: long IDvalue; (2)添加语句: CStudentID(10rlg id=0) (3)添加语句:一 CStudentID() (4)添加语句: CStudent I nfo (char stName= “no name”, long StID=0):id(StID) 【试题解析】 程序中定义了两个类 CStudentlD和 CStudentlnfo,其中类CStudentlD包含学生的学号信息的成员变量,有自定义构造函数和默认析构函数,而类 CStudentlnfo不仅包含学生的学号还包括对应的姓名信息的成员变量,还实现了自定义构造函数。

展开阅读全文
相关资源
猜你喜欢
  • STAS SR ISO 2148-1995 Continuous handling equipment - Nomenclature《连续装卸设备.命名 》.pdf STAS SR ISO 2148-1995 Continuous handling equipment - Nomenclature《连续装卸设备.命名 》.pdf
  • STAS SR ISO 2157-1995 Dentai rotary instruments - Nominal diameters and designation code number《牙科旋转仪器.公称直径和命名代码 》.pdf STAS SR ISO 2157-1995 Dentai rotary instruments - Nominal diameters and designation code number《牙科旋转仪器.公称直径和命名代码 》.pdf
  • STAS SR ISO 2160-1995 Petroleum products Corrosiveness to copper Copper strip test《石油产品.铜的腐蚀.铜带试验 》.pdf STAS SR ISO 2160-1995 Petroleum products Corrosiveness to copper Copper strip test《石油产品.铜的腐蚀.铜带试验 》.pdf
  • STAS SR ISO 2170-1996 Cereals and pulses -Sampling of milled products《谷物和豆类.碾磨产品的采样 》.pdf STAS SR ISO 2170-1996 Cereals and pulses -Sampling of milled products《谷物和豆类.碾磨产品的采样 》.pdf
  • STAS SR ISO 2205-1996 Textile machinery and accessories - Drafting arrangements for spinning machines - Terminology《纺纱机械及配件.起草安排纺纱机术语 》.pdf STAS SR ISO 2205-1996 Textile machinery and accessories - Drafting arrangements for spinning machines - Terminology《纺纱机械及配件.起草安排纺纱机术语 》.pdf
  • STAS SR ISO 2211-1994 LIQUID CHEMICAL PRODUCTS - Measurement of colour in Hazen units (platinum-cobalt scale)《液体化工产品.颜色在黑曾色度单位中的测量(铂钴比额表) 》.pdf STAS SR ISO 2211-1994 LIQUID CHEMICAL PRODUCTS - Measurement of colour in Hazen units (platinum-cobalt scale)《液体化工产品.颜色在黑曾色度单位中的测量(铂钴比额表) 》.pdf
  • STAS SR ISO 2262-1994 General purpose thimbles for use with steel wire ropes — Specification《钢丝绳使用的通用支撑环.规范 》.pdf STAS SR ISO 2262-1994 General purpose thimbles for use with steel wire ropes — Specification《钢丝绳使用的通用支撑环.规范 》.pdf
  • STAS SR ISO 2268-1995 Surface active agents (non-ionic) - Determination of poly-ethylene glycols and non-ionic active matter (adducts) -Weibull method《表面活性剂(非离子型).聚乙烯乙二醇和非离子活性物质(加合.pdf STAS SR ISO 2268-1995 Surface active agents (non-ionic) - Determination of poly-ethylene glycols and non-ionic active matter (adducts) -Weibull method《表面活性剂(非离子型).聚乙烯乙二醇和非离子活性物质(加合.pdf
  • STAS SR ISO 2270-1995 Nonionic surface active agents - Polyetoxilated dertvates lodometrical determination of the oxyethylenic groups《非离子表面.活性剂.乙氧乙烯基化的聚乙氧基衍生物碘量法测定 》.pdf STAS SR ISO 2270-1995 Nonionic surface active agents - Polyetoxilated dertvates lodometrical determination of the oxyethylenic groups《非离子表面.活性剂.乙氧乙烯基化的聚乙氧基衍生物碘量法测定 》.pdf
  • 相关搜索

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

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