【计算机类职业资格】计算机二级(C++)上机考试28及答案解析.doc

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

1、计算机二级(C+)上机考试 28 及答案解析(总分:-3.00,做题时间:90 分钟)1.改错题 使用 VC6 打开考生文件夹下的工程 test3_1,此工程包含一个源程序文件 test3_1.cpp,但该程序运行有问题,请改正程序中的错误,使程序的输出结果如下: A:a=5 display1:a=6 display2:a=5 源程序文件 test3_1.cpp 清单如下: #include class A public: /*found*/ A() void printa()couty) t=x; x=y; y=t; coutz) t=x; x=z; z=t; if(yz) t=y; y=z

2、 z=t; coutx/ty/tz解析:本题考查考生对函数重载与引用调用的掌握。这里的重载是使用不同的参数个数,引用调用的形参使用 Vector(Vector int void display(); void set(); Vector(); protected: int size; int *buffer; ; Vector:Vector(int s) / * 1 * Vector:Vector(Vector i“error in index“elem(j)_正确答案:((1) size=s; buffer=new intsize; (2) size=v.size; buffer=new intsize; (3) if (ndx=size) (4) cout“d“解析:本题主要考查考生对于类的构造函数与成员函数定义的掌握,注意(2)中赋值的应用,为了防止重复删除,不能直接将指针赋值,必须使用动态申请 new 建立一块新的空间,并且将原来对象的成员全部复制到新的空间中;(4)中对动态一维数组空间删除的时候,应该使用 delete 关键字,并且不管原数组大小是多少,一律只写一对中括号“加上变量名。

展开阅读全文
相关资源
猜你喜欢
  • EN ISO 14554-2-2013 en Quality requirements for welding - Resistance welding of metallic materials - Part 2 Elementary quality requirements《焊接的质量要求 金属材料的电阻焊接 第2部分 基本质量要求》.pdf EN ISO 14554-2-2013 en Quality requirements for welding - Resistance welding of metallic materials - Part 2 Elementary quality requirements《焊接的质量要求 金属材料的电阻焊接 第2部分 基本质量要求》.pdf
  • EN ISO 14555-2014 en Welding - Arc stud welding of metallic materials《焊接 金属材料的电弧螺柱焊接(ISO 14555 2014 Corrected version 2014-06-01)》.pdf EN ISO 14555-2014 en Welding - Arc stud welding of metallic materials《焊接 金属材料的电弧螺柱焊接(ISO 14555 2014 Corrected version 2014-06-01)》.pdf
  • EN ISO 14555-2017 en Welding - Arc stud welding of metallic materials.pdf EN ISO 14555-2017 en Welding - Arc stud welding of metallic materials.pdf
  • EN ISO 14556-2015 en Metallic materials - Charpy Vnotch pendulum impact test - Instrumented test method《金属材料 夏比V型缺口摆锤冲击试验 仪器测试方法(ISO 14556 2015)》.pdf EN ISO 14556-2015 en Metallic materials - Charpy Vnotch pendulum impact test - Instrumented test method《金属材料 夏比V型缺口摆锤冲击试验 仪器测试方法(ISO 14556 2015)》.pdf
  • EN ISO 14557-2002 en Fire-fighting hoses - Rubber and plastics suction hoses and hose assemblies (Incorporates Amendment A1 2007)《消防软管 橡胶和塑料制吸入软管和软管组件ISO 14557-2002》.pdf EN ISO 14557-2002 en Fire-fighting hoses - Rubber and plastics suction hoses and hose assemblies (Incorporates Amendment A1 2007)《消防软管 橡胶和塑料制吸入软管和软管组件ISO 14557-2002》.pdf
  • EN ISO 14565-2000 en Animal Feeding Stuffs - Determination of Vitamin A Content - Method Using High-Performance Liquid Chromatography《动物饲料 维生素A含量测定 高性能液相色谱法 ISO 14565-2000》.pdf EN ISO 14565-2000 en Animal Feeding Stuffs - Determination of Vitamin A Content - Method Using High-Performance Liquid Chromatography《动物饲料 维生素A含量测定 高性能液相色谱法 ISO 14565-2000》.pdf
  • EN ISO 14574-2016 en Fine ceramics (advanced ceramics advanced technical ceramics) - Mechanical properties of ceramic composites at high temperature - Determination of tensile prop.pdf EN ISO 14574-2016 en Fine ceramics (advanced ceramics advanced technical ceramics) - Mechanical properties of ceramic composites at high temperature - Determination of tensile prop.pdf
  • EN ISO 14577-1-2015 en Metallic materials - Instrumented indentation test for hardness and materials parameters - Part 1 Test method《金属材料 压痕硬度和材料参数的压痕试验 第1部分 试验方法(ISO 14577-1 2015).pdf EN ISO 14577-1-2015 en Metallic materials - Instrumented indentation test for hardness and materials parameters - Part 1 Test method《金属材料 压痕硬度和材料参数的压痕试验 第1部分 试验方法(ISO 14577-1 2015).pdf
  • EN ISO 14577-2-2015 en Metallic materials - Instrumented indentation test for hardness and materials parameters - Part 2 Verification and calibration of testing machines《金属材料 压痕硬度和.pdf EN ISO 14577-2-2015 en Metallic materials - Instrumented indentation test for hardness and materials parameters - Part 2 Verification and calibration of testing machines《金属材料 压痕硬度和.pdf
  • 相关搜索

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

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