【计算机类职业资格】三级网络技术机试-25及答案解析.doc

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

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

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

3、);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. x1, bbi. x2, bbix3, bbi. x1+bbi. x3);fprintf(out, “%d, %d, %d/n“

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

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

6、)int count;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. x1, bbi. x2,

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

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

展开阅读全文
相关资源
猜你喜欢
  • ITU-T X 1206-2008 A vendor-neutral framework for automatic notification of security related information and dissemination of updates (Study Group 17)《相关安全信息和传播更新的自动通知的厂商独立框架 17号研究组.pdf ITU-T X 1206-2008 A vendor-neutral framework for automatic notification of security related information and dissemination of updates (Study Group 17)《相关安全信息和传播更新的自动通知的厂商独立框架 17号研究组.pdf
  • ITU-T X 1207 FRENCH-2008 Guidelines for telecommunication service providers for addressing the risk of spyware and potentially unwanted software《处理间谍软件和潜在流氓软件风险的电信业务供应商指南 17号研究组》.pdf ITU-T X 1207 FRENCH-2008 Guidelines for telecommunication service providers for addressing the risk of spyware and potentially unwanted software《处理间谍软件和潜在流氓软件风险的电信业务供应商指南 17号研究组》.pdf
  • ITU-T X 1207 SPANISH-2008 Guidelines for telecommunication service providers for addressing the risk of spyware and potentially unwanted software《处理间谍软件和潜在流氓软件风险的电信业务供应商指南 17号研究组》.pdf ITU-T X 1207 SPANISH-2008 Guidelines for telecommunication service providers for addressing the risk of spyware and potentially unwanted software《处理间谍软件和潜在流氓软件风险的电信业务供应商指南 17号研究组》.pdf
  • ITU-T X 1207-2008 Guidelines for telecommunication service providers for addressing the risk of spyware and potentially unwanted software《处理间谍软件和潜在流氓软件风险的电信业务供应商指南 17号研究组》.pdf ITU-T X 1207-2008 Guidelines for telecommunication service providers for addressing the risk of spyware and potentially unwanted software《处理间谍软件和潜在流氓软件风险的电信业务供应商指南 17号研究组》.pdf
  • ITU-T X 1208-2014 A cybersecurity indicator of risk to enhance confidence and security in the use of telecommunication information and communication technologies (Study Group 17)《网.pdf ITU-T X 1208-2014 A cybersecurity indicator of risk to enhance confidence and security in the use of telecommunication information and communication technologies (Study Group 17)《网.pdf
  • ITU-T X 1209-2010 Capabilities and their context scenarios for cybersecurity information sharing and exchange《网络安全信息共享和交换的背景场景和能力 (研究组17)》.pdf ITU-T X 1209-2010 Capabilities and their context scenarios for cybersecurity information sharing and exchange《网络安全信息共享和交换的背景场景和能力 (研究组17)》.pdf
  • ITU-T X 121 FRENCH-2000 International numbering plan for public data networks《公共数据网的国际编号方案 X系列 数据网及开放系统通信 公共数据网 网络方面 7号研究组》.pdf ITU-T X 121 FRENCH-2000 International numbering plan for public data networks《公共数据网的国际编号方案 X系列 数据网及开放系统通信 公共数据网 网络方面 7号研究组》.pdf
  • ITU-T X 121 SPANISH-2000 International numbering plan for public data networks《公共数据网的国际编号方案 X系列 数据网及开放系统通信 公共数据网 网络方面 7号研究组》.pdf ITU-T X 121 SPANISH-2000 International numbering plan for public data networks《公共数据网的国际编号方案 X系列 数据网及开放系统通信 公共数据网 网络方面 7号研究组》.pdf
  • ITU-T X 121-2000 International Numbering Plan for Public Data Networks Series X Data Networks and Open System Communications Public Data Networks - Network Aspects (Study Group 7)《.pdf ITU-T X 121-2000 International Numbering Plan for Public Data Networks Series X Data Networks and Open System Communications Public Data Networks - Network Aspects (Study Group 7)《.pdf
  • 相关搜索

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

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