【计算机类职业资格】计算机二级(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 关键字,并且不管原数组大小是多少,一律只写一对中括号“加上变量名。

展开阅读全文
相关资源
猜你喜欢
  • NEMA C78 1420-2001 Electric Lamps - Microfilm Projection Lamps - Two-Inch (51 mm) Dichroic Coated Integral Reflector Rim Reference Tungsten Halogen Lamps with GX5 3 Bases《电灯 缩微胶片投影.pdf NEMA C78 1420-2001 Electric Lamps - Microfilm Projection Lamps - Two-Inch (51 mm) Dichroic Coated Integral Reflector Rim Reference Tungsten Halogen Lamps with GX5 3 Bases《电灯 缩微胶片投影.pdf
  • NEMA C78 1421-2002 Electric Lamps - Dimensions and Centering Systems for Projection Lamps - 35 mm Integral Reflector Rim Referencing Lamps with GZ4 Bases.pdf NEMA C78 1421-2002 Electric Lamps - Dimensions and Centering Systems for Projection Lamps - 35 mm Integral Reflector Rim Referencing Lamps with GZ4 Bases.pdf
  • NEMA C78 1430-1997 Electric Lamps - Slide Projector Lamps Condensing Dichroic 1 65-in (42 mm) Integral Reflector Rim Reference Tungsten-Halogen Lamps with GX5 3 Bases《电灯 幻灯放映灯 带GX5.pdf NEMA C78 1430-1997 Electric Lamps - Slide Projector Lamps Condensing Dichroic 1 65-in (42 mm) Integral Reflector Rim Reference Tungsten-Halogen Lamps with GX5 3 Bases《电灯 幻灯放映灯 带GX5.pdf
  • NEMA C78 1431-1997 Electric Lamps-Slide Projector Lamps Condensing Dichroic Two-inch (51mm) Integral Reflector Rim Reference Tungsten- Halogen Lamps with GY 5 3 Bases《电灯 幻灯放映机灯 带GY.pdf NEMA C78 1431-1997 Electric Lamps-Slide Projector Lamps Condensing Dichroic Two-inch (51mm) Integral Reflector Rim Reference Tungsten- Halogen Lamps with GY 5 3 Bases《电灯 幻灯放映机灯 带GY.pdf
  • NEMA C78 1432-1997 Electric Lamps - Tungsten Halogen Lamps with GZ9 5 Two Pin Prefocus Bases and 36 5mm Nominal Light Center Length (First Edition)《电灯 带GZ9 5双插头 预聚焦灯座和36 5 mm标定光源中心.pdf NEMA C78 1432-1997 Electric Lamps - Tungsten Halogen Lamps with GZ9 5 Two Pin Prefocus Bases and 36 5mm Nominal Light Center Length (First Edition)《电灯 带GZ9 5双插头 预聚焦灯座和36 5 mm标定光源中心.pdf
  • NEMA C78 1433-2001 Electric Lamps - Two-Inch (51 mm) Dichroic Coated Integral Reflector Rim Reference Tungsten Halogen Large Screen Projection Lamps with GX5 3 Bases (Replaces ANSI.pdf NEMA C78 1433-2001 Electric Lamps - Two-Inch (51 mm) Dichroic Coated Integral Reflector Rim Reference Tungsten Halogen Large Screen Projection Lamps with GX5 3 Bases (Replaces ANSI.pdf
  • NEMA C78 1434-2001 Electric Lamps - Condensing Dichroic Coated Integral Reflector Side Pin Tungsten Halogen Projection Lamps with GX7 9 Bases《电灯 带GX7 9基座的冷凝二色性涂层整体反光侧钉的卤钨投射灯[代替 ANS.pdf NEMA C78 1434-2001 Electric Lamps - Condensing Dichroic Coated Integral Reflector Side Pin Tungsten Halogen Projection Lamps with GX7 9 Bases《电灯 带GX7 9基座的冷凝二色性涂层整体反光侧钉的卤钨投射灯[代替 ANS.pdf
  • NEMA C78 1435-2002 Electric Lamps - Projection Lamps - Tungsten - Halogen Lamps with G5 3 Bases (Consolidation Revision of ANSI C78 1418-1991 and ANSI C78 1419-1991)《电灯泡 投影灯 带G5 3基.pdf NEMA C78 1435-2002 Electric Lamps - Projection Lamps - Tungsten - Halogen Lamps with G5 3 Bases (Consolidation Revision of ANSI C78 1418-1991 and ANSI C78 1419-1991)《电灯泡 投影灯 带G5 3基.pdf
  • NEMA C78 1450-1983 Projection Lamps Incandescent Method for Life Testing《电灯 白炽投影灯 寿命试验方法[代替 ANSI C78 1450 ANSI C78 1450]》.pdf NEMA C78 1450-1983 Projection Lamps Incandescent Method for Life Testing《电灯 白炽投影灯 寿命试验方法[代替 ANSI C78 1450 ANSI C78 1450]》.pdf
  • 相关搜索

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

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