【计算机类职业资格】国家二级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实现各种输出操作。

展开阅读全文
相关资源
猜你喜欢
  • DIN EN 13313-2011 Refrigerating systems and heat pumps - Competence of personnel German version EN 13313 2010《制冷系统和热泵 工作人员能力 德文版本EN 13313-2010》.pdf DIN EN 13313-2011 Refrigerating systems and heat pumps - Competence of personnel German version EN 13313 2010《制冷系统和热泵 工作人员能力 德文版本EN 13313-2010》.pdf
  • DIN EN 13314-2003 Tanks for transport of dangerous goods - Service equipment for tanks - Fill hole cover German version EN 13314 2002《危险品运输槽罐车 槽罐车辅助设备 装载孔封盖》.pdf DIN EN 13314-2003 Tanks for transport of dangerous goods - Service equipment for tanks - Fill hole cover German version EN 13314 2002《危险品运输槽罐车 槽罐车辅助设备 装载孔封盖》.pdf
  • DIN EN 13315-2002 Tanks for transport of dangerous goods - Service equipment for tanks - Gravity discharge coupler German version EN 13315 2002《危险物品运输用储罐 储罐的使用设备 重力式卸载耦合器 德文版本 EN 1.pdf DIN EN 13315-2002 Tanks for transport of dangerous goods - Service equipment for tanks - Gravity discharge coupler German version EN 13315 2002《危险物品运输用储罐 储罐的使用设备 重力式卸载耦合器 德文版本 EN 1.pdf
  • DIN EN 13316-2003 Tanks for transport of dangerous goods - Service equipment for tanks - Pressure balanced footvalve German version EN 13316 2002《危险物品运输槽罐车 槽罐车辅助设备 压力平衡底阀》.pdf DIN EN 13316-2003 Tanks for transport of dangerous goods - Service equipment for tanks - Pressure balanced footvalve German version EN 13316 2002《危险物品运输槽罐车 槽罐车辅助设备 压力平衡底阀》.pdf
  • DIN EN 13317-2007 Tanks for transport of dangerous goods - Service equipment for tanks - Manhole cover assembly (includes Amendment A1 2006) English version of DIN EN 13317 2007-02.pdf DIN EN 13317-2007 Tanks for transport of dangerous goods - Service equipment for tanks - Manhole cover assembly (includes Amendment A1 2006) English version of DIN EN 13317 2007-02.pdf
  • DIN EN 13318-2000 Screed material and floor screeds - Definitions Trilingual version EN 13318 2000《找平材料和地板找平层 定义》.pdf DIN EN 13318-2000 Screed material and floor screeds - Definitions Trilingual version EN 13318 2000《找平材料和地板找平层 定义》.pdf
  • DIN EN 13319-2000 Diving accessories - Depth gauges and combined depth and time measuring devices - Functional and safety requirements test methods German version EN 13319 2000《潜水设.pdf DIN EN 13319-2000 Diving accessories - Depth gauges and combined depth and time measuring devices - Functional and safety requirements test methods German version EN 13319 2000《潜水设.pdf
  • DIN EN 1332-1-2009 en 8697 Identification card systems - Human-machine interface - Part 1 Design principles for the user interface English version of DIN EN 1332-1 2009-10《识别卡系统 人机.pdf DIN EN 1332-1-2009 en 8697 Identification card systems - Human-machine interface - Part 1 Design principles for the user interface English version of DIN EN 1332-1 2009-10《识别卡系统 人机.pdf
  • DIN EN 1332-2-1999 Identification card systems - Man-machine interface - Part 2 Dimensions and location of a tactile identifier for ID-1 cards German version EN 1332-2 1998《识别卡系统 人.pdf DIN EN 1332-2-1999 Identification card systems - Man-machine interface - Part 2 Dimensions and location of a tactile identifier for ID-1 cards German version EN 1332-2 1998《识别卡系统 人.pdf
  • 相关搜索

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

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