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

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

1、国家二级 C+机试(操作题)模拟试卷 357及答案解析(总分:6.00,做题时间:90 分钟)一、基本操作题(总题数:1,分数:2.00)1.使用 VC6打开考生文件夹下的源程序文件 modicpp,该程序运行时有错误,请改正错误,使得程序正常运行,并且要求最后一个 catch()必须抛出执行的任何异常。 程序通过抛出异常输出: error 0 ERROR 注意:不要改动 main函数,不能增行或删行,也不能更改程序的结构,错误的语句在 *error*的下面。 linclude int msin() try throw(“error”); *error* catch(char s) coutn

2、ext; h 一next=NULL; while(s!=NULL) for(t=s,v=h; v!=NULL V 一datadata;u=v,v= V一next); s=s 一next; if(v=h) h=t; else u 一neXt=v; t 一next=v: return h; void msin() TestClass*h=NULL; TestClass*q=NULL; do int data; coutdata; if(data=0)brea k; TestClass*p= new TestClass(data); if(h=NULL) h=q=p; else q 一SetNext

3、p); q=p; while(1); h=fun(h); for(;h!=NULL;) q=h 一next; coutnext; h 一next=NULL; while(s!=NULL) for(t=s,v=h; v!=NULL V 一datadata;u=v,v= V一next); s=s 一next; if(v=h) h=t; else u 一neXt=v; t 一next=v: return h; void msin() TestClass*h=NULL; TestClass*q=NULL; do int data; coutdata; if(data=0)brea k; TestCl

4、ass*p= new TestClass(data); if(h=NULL) h=q=p; else q 一SetNext(p); q=p; while(1); h=fun(h); for(;h!=NULL;) q=h 一next; coutdata“”_正确答案:(正确答案:(1)添加语句:Testclass(int d) (2)添加语句: friend Testclas s*fun(TestClass*); (3)添加语句:friend void main(); (4)添加语句:h=q;)解析:解析:本题的功能是将键盘输入的数字建立一个链表。在 VC环境下打开程序,根据题干给出的几条功能要求,对程序中给出注释下的内容逐个补全或修改。从已定源程序的 main主函数开始入手,可以看出程序通过调用类 TestClass和函数 fun实现各种输出操作。

展开阅读全文
相关资源
猜你喜欢
  • JUS N B4 931-1993 Lightning protection-Steel installation elements coated with Zn - Supports for streched conductors over thatched roofs《防防雷装置 镀锌钢制安装元件 茅草屋顶上拉伸导体用支撑件》.pdf JUS N B4 931-1993 Lightning protection-Steel installation elements coated with Zn - Supports for streched conductors over thatched roofs《防防雷装置 镀锌钢制安装元件 茅草屋顶上拉伸导体用支撑件》.pdf
  • JUS N B4 932-1993 Lightning protection-Steel installation elements coated with Zn - Joints and terminals《防雷保护 镀锌钢制安装元件 节点和端子》.pdf JUS N B4 932-1993 Lightning protection-Steel installation elements coated with Zn - Joints and terminals《防雷保护 镀锌钢制安装元件 节点和端子》.pdf
  • JUS N B4 942-1993 Lightning protection-Steel installation elements coated with Zn - Pipe earth electrode《照明保护 锌层钢制安装基础 接地电极 管道》.pdf JUS N B4 942-1993 Lightning protection-Steel installation elements coated with Zn - Pipe earth electrode《照明保护 锌层钢制安装基础 接地电极 管道》.pdf
  • JUS N B4 943-1993 Lightning protection-Steel installation elements coated with Zn - Rod earth electrodes《防雷保护 镀锌钢制安装元件 接地电极棒》.pdf JUS N B4 943-1993 Lightning protection-Steel installation elements coated with Zn - Rod earth electrodes《防雷保护 镀锌钢制安装元件 接地电极棒》.pdf
  • JUS N B4 944-1993 Lightning protection-Steel installation elements coated with Zn - Section earth electrodes《照明保护 锌层钢制安装基础 接地电极部分》.pdf JUS N B4 944-1993 Lightning protection-Steel installation elements coated with Zn - Section earth electrodes《照明保护 锌层钢制安装基础 接地电极部分》.pdf
  • JUS N B5 111-1993 Telecontrol equipment and systems - Part 1 General considerations - Section one - General principles《远程控制设备和系统 第J部分:通用条件 第一节:一般原理》.pdf JUS N B5 111-1993 Telecontrol equipment and systems - Part 1 General considerations - Section one - General principles《远程控制设备和系统 第J部分:通用条件 第一节:一般原理》.pdf
  • JUS N B5 121-1993 Telecontrol equipment and systems - Part 2 Operating conditions - Section One - Environmental conditions and power supplies《远程控制设备和系统 第二部分:运行条件 第一节:环境条件》.pdf JUS N B5 121-1993 Telecontrol equipment and systems - Part 2 Operating conditions - Section One - Environmental conditions and power supplies《远程控制设备和系统 第二部分:运行条件 第一节:环境条件》.pdf
  • JUS N B9 805-1990 Calculation of the effects ofshort-circuitcurrents《短路电流的影响计算》.pdf JUS N B9 805-1990 Calculation of the effects ofshort-circuitcurrents《短路电流的影响计算》.pdf
  • JUS N C0 003-1980 Designation of telecommunication cables with paper insulation and metalic sheath《带纸绝缘及金属外壳的通讯线缆名称》.pdf JUS N C0 003-1980 Designation of telecommunication cables with paper insulation and metalic sheath《带纸绝缘及金属外壳的通讯线缆名称》.pdf
  • 相关搜索

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

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