【计算机类职业资格】2011年春江苏计算机二级VC++上机1及答案解析.doc

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

1、2011 年春江苏计算机二级 VC+上机 1 及答案解析(总分:40.00,做题时间:70 分钟)1.改错题(20 分) 【题目】 以下程序的功能是:判断一个已排序的整型数组中是否存在元素值与其下标值相等(下标从 0 开始)的元素。如果存在,则输出其中一个该类元素的值(可能存在多个满足条件的元素) 正确程序的输出如下: 第 3 个元素值与其下标值相等 含有错误的源程序如下: #include int index_search(int xn,int n) int first=0; int last=n-1; int middle,index; index=-1; while(firstmiddl

2、e) last=middle-1; else first=middle+1; return index; void main() int a=-1,0,1,3,8; int result=index_search(a,sizeof(a); if(result=-1) coutmiddle) last=middle-1; else first=middle+1; return index; void main() int a=-1,0,1,3,8; int result=index_search(a,sizeof(a); if(result=-1) cout=0 或 result)解析:2.编程

3、题(20 分) 【题目】 试定义一个时间类 time,具体要求如下: (1)私有数据成员。 ?int h,m,s:分别表示时、分和秒。 ?char *str_t:存放时间的字符串,格式为“hh:mm:ss“,即“时:分:秒“。 (2)公有成员函数。 ?time(int hh=0,int mm=0,int ss=0):构造函数,利用参数 hh、mm 和 ss 分别初始化成员 h、m 和s,并为字符串 str_t 分配 9 个字节的动态存储空间。要检查参数 hh、mm 和 ss 的合法性,即0hh=0 *str_t=/0: convert(); void time:convert() char *tmp; tmp=itoa(h); strcat(str t,tmp); strcat(str_t,“:“); tmp=itoa(m); strcat(str_t,tmp); strcat(str_t,“:“); tmp=itoa(s); strcat(str_t,tmp); delete tmp; void main() time t1; t1.convert(); t1.print(); t1.set_t(11,5,30); t1.print(); )解析:

展开阅读全文
相关资源
猜你喜欢
  • BS EN ISO 22432-2011 Geometrical product specifications (GPS) Features utilized in specification and verification《产品几何量技术规范(GPS) 规范中使用的特征和验证》.pdf BS EN ISO 22432-2011 Geometrical product specifications (GPS) Features utilized in specification and verification《产品几何量技术规范(GPS) 规范中使用的特征和验证》.pdf
  • BS EN ISO 22434-2011 Transportable gas cylinders Inspection and maintenance of cylinder valves《可运输气瓶 气瓶阀检查和维护》.pdf BS EN ISO 22434-2011 Transportable gas cylinders Inspection and maintenance of cylinder valves《可运输气瓶 气瓶阀检查和维护》.pdf
  • BS EN ISO 22442-1-2015 Medical devices utilizing animal tissues and their derivatives Application of risk management《医疗设备用动物组织及其衍生物 风险管理的应用》.pdf BS EN ISO 22442-1-2015 Medical devices utilizing animal tissues and their derivatives Application of risk management《医疗设备用动物组织及其衍生物 风险管理的应用》.pdf
  • BS EN ISO 22442-2-2015 Medical devices utilizing animal tissues and their derivatives Controls on sourcing collection and handling《医疗设备用动物组织及其衍生物 来源控制 采集和处理》.pdf BS EN ISO 22442-2-2015 Medical devices utilizing animal tissues and their derivatives Controls on sourcing collection and handling《医疗设备用动物组织及其衍生物 来源控制 采集和处理》.pdf
  • BS EN ISO 22475-1-2006 Geotechnical investigation and testing - Sampling methods and groundwater measurements - Technical principles for execution《土工勘查和试验 抽样法和地下水测量 执行技术原则》.pdf BS EN ISO 22475-1-2006 Geotechnical investigation and testing - Sampling methods and groundwater measurements - Technical principles for execution《土工勘查和试验 抽样法和地下水测量 执行技术原则》.pdf
  • BS EN ISO 22476-11-2017 Geotechnical investigation and testing Field testing Flat dilatometer test《土工调查和检验 现场检验 扁平膨胀计试验》.pdf BS EN ISO 22476-11-2017 Geotechnical investigation and testing Field testing Flat dilatometer test《土工调查和检验 现场检验 扁平膨胀计试验》.pdf
  • BS EN ISO 22476-12-2009 Geotechnical investigation and testing - Field testing - Mechanical cone penetration test (CPTM)《岩土工程勘察与测试 实地试验 机械静力触探测试(CPTM)》.pdf BS EN ISO 22476-12-2009 Geotechnical investigation and testing - Field testing - Mechanical cone penetration test (CPTM)《岩土工程勘察与测试 实地试验 机械静力触探测试(CPTM)》.pdf
  • BS EN ISO 22476-15-2016 Geotechnical investigation and testing Field testing Measuring while drilling《岩土工程勘察和试验 现场试验 随钻测量》.pdf BS EN ISO 22476-15-2016 Geotechnical investigation and testing Field testing Measuring while drilling《岩土工程勘察和试验 现场试验 随钻测量》.pdf
  • BS EN ISO 22476-4-2012 Geotechnical investigation and testing Field testing Ménard pressuremeter test《土工调查和试验 现场试验 梅纳德(Ménard)压力计试验》.pdf BS EN ISO 22476-4-2012 Geotechnical investigation and testing Field testing Ménard pressuremeter test《土工调查和试验 现场试验 梅纳德(Ménard)压力计试验》.pdf
  • 相关搜索

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

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