【计算机类职业资格】三级信息管理技术机试-135及答案解析.doc

上传人:刘芸 文档编号:1320625 上传时间:2019-10-17 格式:DOC 页数:4 大小:28.50KB
下载 相关 举报
【计算机类职业资格】三级信息管理技术机试-135及答案解析.doc_第1页
第1页 / 共4页
【计算机类职业资格】三级信息管理技术机试-135及答案解析.doc_第2页
第2页 / 共4页
【计算机类职业资格】三级信息管理技术机试-135及答案解析.doc_第3页
第3页 / 共4页
【计算机类职业资格】三级信息管理技术机试-135及答案解析.doc_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

1、三级信息管理技术机试-135 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.在文件 in75.dat 中有 200 组数据,每组有 3 个数,每个数均为 3 位数。函数 readDat()是读取这 200组数存放到结构数组 aa 中。请编制函数 JsSort(),其函数的功能是:要求在 200 组数据中找出条件为每组数据中的第一个数大于第二个数加第三个数之和,其中满足条件的个数作为函数 JsSort()的返回值,同时把满足条件的数据存入结构数组 bb 中,再对 bb 中的数按照每组数据的第一个数加第三个数之和的大小进行升序排列(第一个数加

2、第三个数的和均不相等),排序后的结果仍重新存入结构数组 bb 中。最后调用函数 writeDat()把结果 bb 输出到文件 out75.dat。注意:部分源程序已给出。请勿改动主函数 main()、读函数 readDat()和写函数 writeDat()的内容。试题程序:#includestdio.h#includestring.h#includeconio.htypedef structint x1,x2,x3;Data;Data aa200,bb200;int jsSort ()void main()int count;readDat();count=jsSort();writeDat(

3、count);readDat()FILE *in;int i;in=fopen(“in75.dat“,“r“);for(i=0;i200;i+)fscanf(in,“%d %d %d“,fclose(in);writeDat(int count)(FILE *out;int i;clrscr();out=fopen(“out75.dat“,“w“);for(i=0;icount;i+)printf(“%d, %d, %d 第一个数+第三个数=%d/n“,bbi.xl,bbi.x2,bbi.x3,bbi.xl+bbi.x3);fprintf(out,“%d,%d,%d/n“,bbi.xl,bbi

4、x2,bbi.x3);fclose(out);(分数:100.00)_三级信息管理技术机试-135 答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.在文件 in75.dat 中有 200 组数据,每组有 3 个数,每个数均为 3 位数。函数 readDat()是读取这 200组数存放到结构数组 aa 中。请编制函数 JsSort(),其函数的功能是:要求在 200 组数据中找出条件为每组数据中的第一个数大于第二个数加第三个数之和,其中满足条件的个数作为函数 JsSort()的返回值,同时把满足条件的数据存入结构数组 bb 中,再对 bb 中

5、的数按照每组数据的第一个数加第三个数之和的大小进行升序排列(第一个数加第三个数的和均不相等),排序后的结果仍重新存入结构数组 bb 中。最后调用函数 writeDat()把结果 bb 输出到文件 out75.dat。注意:部分源程序已给出。请勿改动主函数 main()、读函数 readDat()和写函数 writeDat()的内容。试题程序:#includestdio.h#includestring.h#includeconio.htypedef structint x1,x2,x3;Data;Data aa200,bb200;int jsSort ()void main()int count

6、readDat();count=jsSort();writeDat(count);readDat()FILE *in;int i;in=fopen(“in75.dat“,“r“);for(i=0;i200;i+)fscanf(in,“%d %d %d“,fclose(in);writeDat(int count)(FILE *out;int i;clrscr();out=fopen(“out75.dat“,“w“);for(i=0;icount;i+)printf(“%d, %d, %d 第一个数+第三个数=%d/n“,bbi.xl,bbi.x2,bbi.x3,bbi.xl+bbi.x3);

7、fprintf(out,“%d,%d,%d/n“,bbi.xl,bbi.x2,bbi.x3);fclose(out);(分数:100.00)_正确答案:(int jsSort()int i,j,count=0;Data val;for(i=0;i200;i+)if(aai.x1aai.x2+aai.x3) /*如果每组数据中的第一个数大于第二、三个数之和*/bbcount.x1=aai.x1; /*把满足条件的数据存入结构数组 bb 中*/bbcount.X2=aai.X2;bbcount.X3=aai.X3;count+; /*统计满足条件的数据的组数*/for(i=0;icount-1;i

8、) /*对 bb 中的数按照每组数据的第一个数加第三个数之和的大小进行升序排列*/for(j=i+1;jcount;j+)if(bbi.x1+bbi.x3bbj.x1+bbi.x3)val=bbi;bbi=bbj;bbj=val;return count; /*满足条件的数据的组数*/)解析:解析 本题考查的知识点如下:(1)结构体及结构数组。(2)数据的排序。(3)函数的返回值。本题中,定义了结构类型和结构数组,这就要涉及到结构体和结构数组的访问。相同类型的结构体变量之间可以直接赋值,也可以依次对结构体中的每个变量进行赋值或访问。排序使用“选择排序法”。函数的值通过 return 语句返回,格式为; return 表达式或 return(表达式)或 return,当函数没有返回值时用第 3 种格式。在本题中,要用第 1 种或第 2 种格式。

展开阅读全文
相关资源
猜你喜欢
  • IEC 62877-1 CORR 1-2017 Electrolyte and water for vented lead acid accumulators - Part 1 Requirements for electrolyte - Corrigendum 1《开口型铅酸蓄电池的电解质和水 第1部分 电解质要求 勘误表1》.pdf IEC 62877-1 CORR 1-2017 Electrolyte and water for vented lead acid accumulators - Part 1 Requirements for electrolyte - Corrigendum 1《开口型铅酸蓄电池的电解质和水 第1部分 电解质要求 勘误表1》.pdf
  • IEC 62877-1-2016 Electrolyte and water for vented lead acid accumulators - Part 1 Requirements for electrolyte《开口型铅酸蓄电池的电解质和水 第1部分 电解质要求》.pdf IEC 62877-1-2016 Electrolyte and water for vented lead acid accumulators - Part 1 Requirements for electrolyte《开口型铅酸蓄电池的电解质和水 第1部分 电解质要求》.pdf
  • IEC 62877-2-2016 Electrolyte and water for vented lead acid accumulators - Part 2 Requirements for water《开口型铅酸蓄电池的电解质和水 第2部分 水的要求》.pdf IEC 62877-2-2016 Electrolyte and water for vented lead acid accumulators - Part 2 Requirements for water《开口型铅酸蓄电池的电解质和水 第2部分 水的要求》.pdf
  • IEC 62878-1-1-2015 Device embedded substrate - Part 1-1 Generic specification - Test methods《装置内埋基板 第1-1部分 通用规格 试验方法》.pdf IEC 62878-1-1-2015 Device embedded substrate - Part 1-1 Generic specification - Test methods《装置内埋基板 第1-1部分 通用规格 试验方法》.pdf
  • IEC 62884-1-2017 Measurement techniques of piezoelectric dielectric and electrostatic oscillators - Part 1 Basic methods for the measurement《压电 介电和静电振荡器的测量技术 第1部分 基本测量方法》.pdf IEC 62884-1-2017 Measurement techniques of piezoelectric dielectric and electrostatic oscillators - Part 1 Basic methods for the measurement《压电 介电和静电振荡器的测量技术 第1部分 基本测量方法》.pdf
  • IEC 62885-3-2014 Surface cleaning appliances - Part 3 Wet carpet cleaning appliances - Methods for measuring the performance《表面清洁用具 第3部分 湿地毯清洗用具 性能测量方法》.pdf IEC 62885-3-2014 Surface cleaning appliances - Part 3 Wet carpet cleaning appliances - Methods for measuring the performance《表面清洁用具 第3部分 湿地毯清洗用具 性能测量方法》.pdf
  • IEC 62894 AMD 1-2016 Photovoltaic inverters - Data sheet and name plate Amendment 1《光电变极器 数据表和名牌.修改件1》.pdf IEC 62894 AMD 1-2016 Photovoltaic inverters - Data sheet and name plate Amendment 1《光电变极器 数据表和名牌.修改件1》.pdf
  • IEC 62909-1-2017 Bi-directional grid-connected power converters - Part 1 General requirements《双向并网电源转换器 第1部分 通用要求》.pdf IEC 62909-1-2017 Bi-directional grid-connected power converters - Part 1 General requirements《双向并网电源转换器 第1部分 通用要求》.pdf
  • IEC 62911-2016 Audio video and information technology equipment - Routine electrical safety testing in production《音频 视频和信息技术设备 生产过程中的例行电气安全试验》.pdf IEC 62911-2016 Audio video and information technology equipment - Routine electrical safety testing in production《音频 视频和信息技术设备 生产过程中的例行电气安全试验》.pdf
  • 相关搜索

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

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