【计算机类职业资格】三级信息管理技术机试-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 种格式。

展开阅读全文
相关资源
猜你喜欢
  • EN ISO 12625-1-2011 en Tissue paper and tissue products - Part 1 General guidance on terms《薄纸和生活用纸产品 第1部分 关于术语的通用指引》.pdf EN ISO 12625-1-2011 en Tissue paper and tissue products - Part 1 General guidance on terms《薄纸和生活用纸产品 第1部分 关于术语的通用指引》.pdf
  • EN ISO 12625-11-2012 en Tissue paper and tissue products - Part 11 Determination of wet ball burst strength《专业化 基本心电图仪(ECG)(1 -3-lead心电图) 纸和组织产品-第11部分 测定湿球爆裂》.pdf EN ISO 12625-11-2012 en Tissue paper and tissue products - Part 11 Determination of wet ball burst strength《专业化 基本心电图仪(ECG)(1 -3-lead心电图) 纸和组织产品-第11部分 测定湿球爆裂》.pdf
  • EN ISO 12625-12-2010 en Tissue paper and tissue products - Part 12 Determination of tensile strength of perforated lines - Calculation of perforation efficiency《薄纸和薄纸产品 第12部分 穿孔线抗拉.pdf EN ISO 12625-12-2010 en Tissue paper and tissue products - Part 12 Determination of tensile strength of perforated lines - Calculation of perforation efficiency《薄纸和薄纸产品 第12部分 穿孔线抗拉.pdf
  • EN ISO 12625-15-2015 en Tissue paper and tissue products - Part 15 Determination of optical properties - Measurement of brightness and colour with C 2 indoor daylight) illuminant《卫.pdf EN ISO 12625-15-2015 en Tissue paper and tissue products - Part 15 Determination of optical properties - Measurement of brightness and colour with C 2 indoor daylight) illuminant《卫.pdf
  • EN ISO 12625-16-2015 en Tissue paper and tissue products - Part 16 Determination of optical properties - Opacity (paper backing) - Diffuse reflectance method《卫生纸及其制品 第16部分 光学特性的测定 .pdf EN ISO 12625-16-2015 en Tissue paper and tissue products - Part 16 Determination of optical properties - Opacity (paper backing) - Diffuse reflectance method《卫生纸及其制品 第16部分 光学特性的测定 .pdf
  • EN ISO 12625-3-2014 en Tissue paper and tissue products - Part 3 Determination of thickness bulking thickness and apparent bulk density and bulk《卫生纸及其制品 第3部分 厚度 层积厚度和表观密度的测定(ISO 12.pdf EN ISO 12625-3-2014 en Tissue paper and tissue products - Part 3 Determination of thickness bulking thickness and apparent bulk density and bulk《卫生纸及其制品 第3部分 厚度 层积厚度和表观密度的测定(ISO 12.pdf
  • EN ISO 12625-4-2016 en Tissue paper and tissue products - Part 4 Determination of tensile strength stretch at maximum force and tensile energy absorption《薄纸和薄纸产品-第4部分 拉伸强度的测定 拉伸断裂和.pdf EN ISO 12625-4-2016 en Tissue paper and tissue products - Part 4 Determination of tensile strength stretch at maximum force and tensile energy absorption《薄纸和薄纸产品-第4部分 拉伸强度的测定 拉伸断裂和.pdf
  • EN ISO 12625-5-2005 459 Tissue paper and tissue products - Part 5 Determination of wet tensile strength《薄纸和薄纸产品 第5部分 湿拉伸强度的测定》.pdf EN ISO 12625-5-2005 459 Tissue paper and tissue products - Part 5 Determination of wet tensile strength《薄纸和薄纸产品 第5部分 湿拉伸强度的测定》.pdf
  • EN ISO 12625-5-2016 en Tissue paper and tissue products - Part 5 Determination of wet tensile strength《薄纸和薄纸产品-第5部分 湿抗张强度的测定(ISO 12625-5 2016)》.pdf EN ISO 12625-5-2016 en Tissue paper and tissue products - Part 5 Determination of wet tensile strength《薄纸和薄纸产品-第5部分 湿抗张强度的测定(ISO 12625-5 2016)》.pdf
  • 相关搜索

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

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