【计算机类职业资格】三级网络技术机试-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,则可实现只访问下标为奇数的数组元素。排序使用前面介绍的“选择排序法”。

展开阅读全文
相关资源
猜你喜欢
  • GOST 30852 13-2002 Explosionproof electrical apparatus  Part 14 Electrical installations in explosive gas atmospheres (other than mines)《防爆电气设备 第14部分 爆炸性气体环境中的电气装置(除矿山外)》.pdf GOST 30852 13-2002 Explosionproof electrical apparatus Part 14 Electrical installations in explosive gas atmospheres (other than mines)《防爆电气设备 第14部分 爆炸性气体环境中的电气装置(除矿山外)》.pdf
  • GOST 30852 14-2002 Electrical apparatus for explosive gas atmospheres Part 15 Type of protection n《爆炸性气体环境用电气设备 第15部分 防护类型n》.pdf GOST 30852 14-2002 Electrical apparatus for explosive gas atmospheres Part 15 Type of protection n《爆炸性气体环境用电气设备 第15部分 防护类型n》.pdf
  • GOST 30852 15-2002 Electrical apparatus for explosive gas atmospheres Part 16 Artificial ventilation for the protection of analyzer(s) houses《爆炸性气体环境用电气设备 第16部分 保护分析仪器房屋的人工通风》.pdf GOST 30852 15-2002 Electrical apparatus for explosive gas atmospheres Part 16 Artificial ventilation for the protection of analyzer(s) houses《爆炸性气体环境用电气设备 第16部分 保护分析仪器房屋的人工通风》.pdf
  • GOST 30852 16-2002 Explosion-prooof electrical apparatus Part 17 Inspection and maintenance of electrical installations in hazardous areas (other than mines)《电气设备防爆 第17部分 危险区域电气装置的.pdf GOST 30852 16-2002 Explosion-prooof electrical apparatus Part 17 Inspection and maintenance of electrical installations in hazardous areas (other than mines)《电气设备防爆 第17部分 危险区域电气装置的.pdf
  • GOST 30852 17-2002 Explosionproof electrical apparatus Part 18 Type of protection (m)《电气设备防爆 第18部分 防护类型(m)》.pdf GOST 30852 17-2002 Explosionproof electrical apparatus Part 18 Type of protection (m)《电气设备防爆 第18部分 防护类型(m)》.pdf
  • GOST 30852 18-2002 Electrical apparatus for explosive gas atmospheres Part 19 Repair and overhaul for apparatus used in explosive atmospheres (other than mines or explosives)《爆炸性气体.pdf GOST 30852 18-2002 Electrical apparatus for explosive gas atmospheres Part 19 Repair and overhaul for apparatus used in explosive atmospheres (other than mines or explosives)《爆炸性气体.pdf
  • GOST 30852 19-2002 Electrical apparatus for explosive gas atmospheres Part 20 Data for flammable gases and vapours relating to the use of electrical apparatus《爆炸性气体环境用电气设备 第20部分 可燃.pdf GOST 30852 19-2002 Electrical apparatus for explosive gas atmospheres Part 20 Data for flammable gases and vapours relating to the use of electrical apparatus《爆炸性气体环境用电气设备 第20部分 可燃.pdf
  • GOST 30852 2-2002 Electrical apparatus for explosive gas atmospheres Part 1 Construction and verification test of flameproof enclosures of electrical apparatus First supplement Appaxim.pdf GOST 30852 2-2002 Electrical apparatus for explosive gas atmospheres Part 1 Construction and verification test of flameproof enclosures of electrical apparatus First supplement Appaxim.pdf
  • GOST 30852 20-2002 Mininq electrical equipment Insulation leakage paths and electrical gaps Technical reguirements and test methods《采矿电气设备 绝缘 泄漏通道和电气缺口 技术要求和试验方法》.pdf GOST 30852 20-2002 Mininq electrical equipment Insulation leakage paths and electrical gaps Technical reguirements and test methods《采矿电气设备 绝缘 泄漏通道和电气缺口 技术要求和试验方法》.pdf
  • 相关搜索

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

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