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

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

1、三级网络技术机试-20 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.函数 readDat()的功能是从文件 in52.dat中读取 20行数据存放到字符串数组 xx中(每行字符串的长度均小于 80)。请编制函数 JsSod(),该函数的功能是:以行为单位对字符串变量的F 标为奇数位置上的字符按其 ASCII 值从小到大的顺序进行排序,排序后的结果仍按行重新存入字符串数组 xx中,最后调用函数 writeDat()把结果 xx输出到文件 out52.dat中。例如: 位置 0 1 2 3 4 5 6 7源字符串 h g f e d c b

2、 a则处理后字符串 h a f c d e b g。注意:部分源程序已给出。请勿改动主函数 main()、读函数 readDat()和写函数 writeDat()的内容。试题程序:#includestdio. h#includestring. h#includeconio. hchar xx20 80;void jsSortvoid main ()readDat ();jsSort ( );writeDat ();readDat ( )FILE *in;int i=0;char *p;in=fopen ( “in52. dat“, “r“ );while(i20 if(p) *p=0;i+;f

3、close (in);writeDat ()FILE *out;int i;out=fopen (“out52 .dat“, “w“);clrscr ( );for (i=0;i20;i+)printf (“%s/n“, xx i );fprint f (out, “%s/n“, xx i );fclose (out);(分数:100.00)_三级网络技术机试-20 答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.函数 readDat()的功能是从文件 in52.dat中读取 20行数据存放到字符串数组 xx中(每行字符串的长度均小于 80)

4、请编制函数 JsSod(),该函数的功能是:以行为单位对字符串变量的F 标为奇数位置上的字符按其 ASCII 值从小到大的顺序进行排序,排序后的结果仍按行重新存入字符串数组 xx中,最后调用函数 writeDat()把结果 xx输出到文件 out52.dat中。例如: 位置 0 1 2 3 4 5 6 7源字符串 h g f e d c b a则处理后字符串 h a f c d e b g。注意:部分源程序已给出。请勿改动主函数 main()、读函数 readDat()和写函数 writeDat()的内容。试题程序:#includestdio. h#includestring. h#incl

5、udeconio. hchar xx20 80;void jsSortvoid main ()readDat ();jsSort ( );writeDat ();readDat ( )FILE *in;int i=0;char *p;in=fopen ( “in52. dat“, “r“ );while(i20 if(p) *p=0;i+;fclose (in);writeDat ()FILE *out;int i;out=fopen (“out52 .dat“, “w“);clrscr ( );for (i=0;i20;i+)printf (“%s/n“, xx i );fprint f (

6、out, “%s/n“, xx i );fclose (out);(分数:100.00)_正确答案:(void jsSort () int i, j,k, strl;char ch;for (i=0; i20; i+) strl=strlen (xx i ); /*求各行字符串的长度*/for (j=l; j strl-2; j=j+2) /*将下标为奇数的字符按其 ASCII值从小到大的顺序进行排序*/for (k=j+2; kstrl; k=k+2)if(xxi jxxi k)ch=xxi j;xxi j=xxi k;xxi k =ch;)解析:解析本题考查的知识点如下:(1)二维数组的坊问及下标控制。(2)数据的排序。在本题中,将数据存放在一个二维数组 xx中。其中以行数为数组的第个下标,以字符串的最大长度 80为其第二个下标。因为以行为字符串处理的单位,首先要使用函数 strlen()求得每一行中字符的个数。只对字符串数组中下标为奇数的字符进行处理,可以从 xx01开始,若需要增加时都增加 2,则可实现只访问下标为奇数的数组元素。排序使用前面介绍的“选择排序法”。

展开阅读全文
相关资源
猜你喜欢
  • DIN EN 15869-3-2010 Inland navigation vessels - Electrical shore connection three phase current 400 V up to 63 A 50 Hz - Part 3 On-board unit safety requirements German version EN .pdf DIN EN 15869-3-2010 Inland navigation vessels - Electrical shore connection three phase current 400 V up to 63 A 50 Hz - Part 3 On-board unit safety requirements German version EN .pdf
  • DIN EN 15870-2009 Adhesives - Determination of tensile strength of butt joints (ISO 6922 1987 modified) English version of DIN EN 15870 2009-08《胶粘剂 对接接头拉伸强度的测定(ISO 6922 1987修改件) DI.pdf DIN EN 15870-2009 Adhesives - Determination of tensile strength of butt joints (ISO 6922 1987 modified) English version of DIN EN 15870 2009-08《胶粘剂 对接接头拉伸强度的测定(ISO 6922 1987修改件) DI.pdf
  • DIN EN 15875-2012 Characterization of waste - Static test for determination of acid potential and neutralisation potential of sulfidic waste German version EN 15875 2011《废料特性描述 硫化物.pdf DIN EN 15875-2012 Characterization of waste - Static test for determination of acid potential and neutralisation potential of sulfidic waste German version EN 15875 2011《废料特性描述 硫化物.pdf
  • DIN EN 15876-1-2016 Electronic fee collection - Evaluation of on-board and roadside equipment for conformity to EN 15509 - Part 1 Test suite structure and test purposes《电子自动收费系统 符合.pdf DIN EN 15876-1-2016 Electronic fee collection - Evaluation of on-board and roadside equipment for conformity to EN 15509 - Part 1 Test suite structure and test purposes《电子自动收费系统 符合.pdf
  • DIN EN 15876-2-2016 Electronic fee collection - Evaluation of on-board and roadside equipment for conformity to EN 15509 - Part 2 Abstract test suite《电子自动收费系统 符合EN 15509标准的车载和路边设备的.pdf DIN EN 15876-2-2016 Electronic fee collection - Evaluation of on-board and roadside equipment for conformity to EN 15509 - Part 2 Abstract test suite《电子自动收费系统 符合EN 15509标准的车载和路边设备的.pdf
  • DIN EN 15877-1-2012 Railway applications Marking on railway vehicles Part 1 Freight wagons German version EN 15877-1 2012《轨道交通 铁路车辆标记 第1部分 货车 德文版本EN 15877-1-2012》.pdf DIN EN 15877-1-2012 Railway applications Marking on railway vehicles Part 1 Freight wagons German version EN 15877-1 2012《轨道交通 铁路车辆标记 第1部分 货车 德文版本EN 15877-1-2012》.pdf
  • DIN EN 15877-2-2014 Railway applications - Markings of railway vehicles - Part 2 External markings on coaches motive power units locomotives and on track machines German version EN.pdf DIN EN 15877-2-2014 Railway applications - Markings of railway vehicles - Part 2 External markings on coaches motive power units locomotives and on track machines German version EN.pdf
  • DIN EN 15878-2011 Steel static storage systems - Terms and definitions German version EN 15878 2010《钢材静态存储系统 术语和定义 德文版本EN 15878-2010》.pdf DIN EN 15878-2011 Steel static storage systems - Terms and definitions German version EN 15878 2010《钢材静态存储系统 术语和定义 德文版本EN 15878-2010》.pdf
  • DIN EN 15879-1-2011 Testing and rating of direct exchange ground coupled heat pumps with electrically driven compressors for space heating and or cooling - Part 1 Direct exchange-t.pdf DIN EN 15879-1-2011 Testing and rating of direct exchange ground coupled heat pumps with electrically driven compressors for space heating and or cooling - Part 1 Direct exchange-t.pdf
  • 相关搜索

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

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