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

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

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

2、排序后的结果仍重新存入结构数组 bb中,最后调用函数 writeDat()把结果 bb输出到 OUT.DAT文件中。注意:部分源程序存在文件 PROG1.C文件中。请勿改动数据文件 IN.DAT中的任何数据、主函数 main()、读函数 readDat()和写函数 writeDat()的内容。试题程序#include #include void readDat();void writeDat(int count);typedef structint x1,x2,x3;Data;Data aa200,bb200;int jsSort()void main()int count;readDat(

3、);count=jsSort();/*返回满足条件的个数*/writeDat(count);void readDat()FILE *in;int i;in=fopen(“in.dat“,“r“);for(i=0;i200;i+)fscanf(in,“%d,%d,%d“,fclose(in);void writeDat(int count)FILE *out;int i;out=fopen(“out.dat”,“W”);for(i=0;icount;i+)printf(“%d,%d,%d 第一个数+第三个数=%d/n“,bbi.x1,bbi.x2,bbi.x3,bbi.x1+bbi.x3);fp

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

5、件的数据存入结构数组 bb中,再对 bb中的数据按照每组数据的第一个数与第三个数之和的大小进行升序排列(第一个数与第三个数的和均不相等),排序后的结果仍重新存入结构数组 bb中,最后调用函数 writeDat()把结果 bb输出到 OUT.DAT文件中。注意:部分源程序存在文件 PROG1.C文件中。请勿改动数据文件 IN.DAT中的任何数据、主函数 main()、读函数 readDat()和写函数 writeDat()的内容。试题程序#include #include void readDat();void writeDat(int count);typedef structint x1,x

6、2,x3;Data;Data aa200,bb200;int jsSort()void main()int count;readDat();count=jsSort();/*返回满足条件的个数*/writeDat(count);void readDat()FILE *in;int i;in=fopen(“in.dat“,“r“);for(i=0;i200;i+)fscanf(in,“%d,%d,%d“,fclose(in);void writeDat(int count)FILE *out;int i;out=fopen(“out.dat”,“W”);for(i=0;icount;i+)pri

7、ntf(“%d,%d,%d 第一个数+第三个数=%d/n“,bbi.x1,bbi.x2,bbi.x3,bbi.x1+bbi.x3);fprintf(out,“%d,%d,%d/n”,bbi.x1,bbi.x2,bbi.x3);fclose(out);(分数:100.00)_正确答案:(int jsSort()int i,j; /*定义变量*/Data temp;int cnt=0;for(i=0;i200;i+)if (aai.x1aai.x2+aai.x3)/*判断条件*/bbcnt+=aai;for(i=0;icnt-1;i+) /*选择法排序*/for(j=i+1;jcnt;j+)if(bbi.x1+bbi.x3bbj.x1+bbj.x3)temp=bbi;bbi=bbj;bbj=temp;return cnt; /*返回函数值*/)解析:解析 本题要求按照一定的判断条件将已知数据组(在代码中表现为结构体)筛选后,再按表达式的大小进行排序。依据题意,应依次从数组 aa中取出每一个数据,根据题干中给出的判断条件(每组数据中的第一个数大于第二个数与第三个数之和,即 aai.x1aai.x2+aai.x3)筛选后,将符合条件的存入数组 bb中,最后将数组 bb中的数据组用选择法按第一个数与第三个数之和的大小进行排序。

展开阅读全文
相关资源
猜你喜欢
  • ASTM F685-1996(2006) Standard Practice for Determining Toner Usage Efficiency and Dusting Nonheat Fixing Copiers Using Single-Component Toner Systems《测定在使用单一成分调色剂系统的非加热固定复印机中调色剂的使用.pdf ASTM F685-1996(2006) Standard Practice for Determining Toner Usage Efficiency and Dusting Nonheat Fixing Copiers Using Single-Component Toner Systems《测定在使用单一成分调色剂系统的非加热固定复印机中调色剂的使用.pdf
  • ASTM F685-1996(2011) Standard Practice for Determining Toner Usage Efficiency and Dusting Nonheat Fixing Copiers Using Single-Component Toner Systems《测定在使用单一成分调色剂系统的非加热固定复印机中调色剂的使用.pdf ASTM F685-1996(2011) Standard Practice for Determining Toner Usage Efficiency and Dusting Nonheat Fixing Copiers Using Single-Component Toner Systems《测定在使用单一成分调色剂系统的非加热固定复印机中调色剂的使用.pdf
  • ASTM F686-1994(2006) Standard Practice for Evaluation of Image Quality Produced by Carbonless Copy Paper with an Electric or Electronic Typewriter《电动打字机打字时无碳复写纸产生的图像质量的评定的标准规程》.pdf ASTM F686-1994(2006) Standard Practice for Evaluation of Image Quality Produced by Carbonless Copy Paper with an Electric or Electronic Typewriter《电动打字机打字时无碳复写纸产生的图像质量的评定的标准规程》.pdf
  • ASTM F686-1994(2011) Standard Practice for Evaluation of Image Quality Produced by Carbonless Copy Paper with an Electric or Electronic Typewriter《用电动打字机打字时无碳复写纸产生的图像质量的评估的标准操作规程》.pdf ASTM F686-1994(2011) Standard Practice for Evaluation of Image Quality Produced by Carbonless Copy Paper with an Electric or Electronic Typewriter《用电动打字机打字时无碳复写纸产生的图像质量的评估的标准操作规程》.pdf
  • ASTM F688-2005 Standard Specification for Wrought Cobalt-35Nickel-20Chromium-10Molybdenum Alloy Plate Sheet and Foil for Surgical Implants (UNS R30035)《外科植入物用锻制钴35镍20铬10钼合金板、薄板及箔标准.pdf ASTM F688-2005 Standard Specification for Wrought Cobalt-35Nickel-20Chromium-10Molybdenum Alloy Plate Sheet and Foil for Surgical Implants (UNS R30035)《外科植入物用锻制钴35镍20铬10钼合金板、薄板及箔标准.pdf
  • ASTM F688-2010 Standard Specification for Wrought Cobalt-35Nickel-20Chromium-10Molybdenum Alloy Plate Sheet and Foil for Surgical Implants (UNS R30035)《外科移植用锻制钴-35镍-20铬-10钼合金板 薄板 及.pdf ASTM F688-2010 Standard Specification for Wrought Cobalt-35Nickel-20Chromium-10Molybdenum Alloy Plate Sheet and Foil for Surgical Implants (UNS R30035)《外科移植用锻制钴-35镍-20铬-10钼合金板 薄板 及.pdf
  • ASTM F688-2014 Standard Specification for Wrought Cobalt-35Nickel-20Chromium-10Molybdenum Alloy Plate Sheet and Foil for Surgical Implants &40 UNS R30035&41 《外壳植入物用钴-35镍-20铬-10钼锻制合.pdf ASTM F688-2014 Standard Specification for Wrought Cobalt-35Nickel-20Chromium-10Molybdenum Alloy Plate Sheet and Foil for Surgical Implants &40 UNS R30035&41 《外壳植入物用钴-35镍-20铬-10钼锻制合.pdf
  • ASTM F689-1997(2004) Standard Practice for Determination of the Temperature of Above-Ground Plastic Gas Pressure Pipe Within Metallic Casings《有金属套管的地上塑料气体压力管的温度测定》.pdf ASTM F689-1997(2004) Standard Practice for Determination of the Temperature of Above-Ground Plastic Gas Pressure Pipe Within Metallic Casings《有金属套管的地上塑料气体压力管的温度测定》.pdf
  • ASTM F693-2001(2007) Standard Practice for Sealing Seams of Resilient Sheet Flooring Products by Use of Liquid Seam Sealers《使用液体封缝剂密封弹性铺地薄板制品接缝的标准实施规范》.pdf ASTM F693-2001(2007) Standard Practice for Sealing Seams of Resilient Sheet Flooring Products by Use of Liquid Seam Sealers《使用液体封缝剂密封弹性铺地薄板制品接缝的标准实施规范》.pdf
  • 相关搜索

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

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