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

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

1、三级网络技术机试-223 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.函数 ReadDat()实现从文件 IN.DAT 中读取一篇英文文章存入到字符串数组 xx 中;请编制函数CharConvA(),其函数的功能是:以该文章中的行为单位把字符串中的最后一个字符的 ASC值右移 4 位二进制位,高位补 0 后加最后第二个字符的 ASC值,得到最后一个新的值,最后第二个字符的 ASC值右移 4 位二进制位,高位补 0 后加最后第三个字符的 ASC值,得到最后第二个新的值,依次类推一直处理到第二个字符。注意:第一个新的值与上述处理不同,第一个

2、字符的 ASC值加原最后一个字符的ASC值,得到第一个新的值。得到的新值分别存放在原字符串对应的位置上,之后把已处理的字符串仍按行重新存入数组 xx 中。最后 main()函数调用函数 WriteDat()把结果 XX 输出到 OUT.DAT 文件中。原始数据文件存放的格式是:每行的宽度均小于 80 个字符,含标点符号和空格,并也按它的 ASC值作以上处理。注意:部分源程序存放在 PROG1.C 中。请勿改动主函数 main()、读数据函数 ReadDat()和输出数据函数WriteDat()的内容。试题程序#include #include char XX5080;int maxline=0

3、/*文章的总行数*/int ReadDaf(void);void WriteDat(void);void CharConvA(void)void main()if(ReadDat()prinff(“数据文件 IN.DAT 不能打开!/n/007”);return;CharConvA();WriteDat();int ReadDat(void)FILE *fp;int i=0;char *p;if(fp=fopen(“in.dat“,“r“)=NULL)return 1;while(fgets(xxi,80,fp)!=NULL)p=strchr(xxi,/n);if(p) *p=0;i+;ma

4、xline=i;fclose(fp);return 0;void WriteDat(void)FILE *fp;int i;fp=fopen(“out.dat“,“w“);for(i=0;imaxline;i+)(printf(“%s/n“,xxi);fprintf(fp,“%s/n“,xxi);fclose(fp);(分数:100.00)_三级网络技术机试-223 答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.函数 ReadDat()实现从文件 IN.DAT 中读取一篇英文文章存入到字符串数组 xx 中;请编制函数CharConvA(),

5、其函数的功能是:以该文章中的行为单位把字符串中的最后一个字符的 ASC值右移 4 位二进制位,高位补 0 后加最后第二个字符的 ASC值,得到最后一个新的值,最后第二个字符的 ASC值右移 4 位二进制位,高位补 0 后加最后第三个字符的 ASC值,得到最后第二个新的值,依次类推一直处理到第二个字符。注意:第一个新的值与上述处理不同,第一个字符的 ASC值加原最后一个字符的ASC值,得到第一个新的值。得到的新值分别存放在原字符串对应的位置上,之后把已处理的字符串仍按行重新存入数组 xx 中。最后 main()函数调用函数 WriteDat()把结果 XX 输出到 OUT.DAT 文件中。原始数

6、据文件存放的格式是:每行的宽度均小于 80 个字符,含标点符号和空格,并也按它的 ASC值作以上处理。注意:部分源程序存放在 PROG1.C 中。请勿改动主函数 main()、读数据函数 ReadDat()和输出数据函数WriteDat()的内容。试题程序#include #include char XX5080;int maxline=0;/*文章的总行数*/int ReadDaf(void);void WriteDat(void);void CharConvA(void)void main()if(ReadDat()prinff(“数据文件 IN.DAT 不能打开!/n/007”);ret

7、urn;CharConvA();WriteDat();int ReadDat(void)FILE *fp;int i=0;char *p;if(fp=fopen(“in.dat“,“r“)=NULL)return 1;while(fgets(xxi,80,fp)!=NULL)p=strchr(xxi,/n);if(p) *p=0;i+;maxline=i;fclose(fp);return 0;void WriteDat(void)FILE *fp;int i;fp=fopen(“out.dat“,“w“);for(i=0;imaxline;i+)(printf(“%s/n“,xxi);fpr

8、intf(fp,“%s/n“,xxi);fclose(fp);(分数:100.00)_正确答案:(void CharConvA(void)int i,j; /*定义变量*/int temp;for(i=0;imaxline;i+) temp=xxistrlen(xxi)-1;/*字符替代*/ for(i=strlen(xxi)-1;j0;j-)xxij=(xxij4)+xxij-1;xxi0+=temp;)解析:解析 本题要求将一篇英文文章中的每个字符移位后,再按一定的步骤进行处理。依据题意,应逐行逐字取得英文文章中的所有字符,将其 ASC值按规定的步骤(ASC值右移 4 位二进制位,高位补 0后加前一个字符的 ASC值,得到一个新的值,其中第一个字符移位后加上本行最后一个字符的值)处理后替代原来的字符。

展开阅读全文
相关资源
猜你喜欢
  • BS EN ISO 9142-2004 Adhesives - Guide to the selection of standard laboratory ageing conditions for testing bonded joints《粘合剂 胶粘件试验用标准实验室老化条件的选择指南》.pdf BS EN ISO 9142-2004 Adhesives - Guide to the selection of standard laboratory ageing conditions for testing bonded joints《粘合剂 胶粘件试验用标准实验室老化条件的选择指南》.pdf
  • BS EN ISO 9151-2016 Protective clothing against heat and flame Determination of heat transmission on exposure to flame《耐热防火防护服 暴露于火焰的热传递测定》.pdf BS EN ISO 9151-2016 Protective clothing against heat and flame Determination of heat transmission on exposure to flame《耐热防火防护服 暴露于火焰的热传递测定》.pdf
  • BS EN ISO 9163-2005 Textile glass - Rovings - Manufacture of test specimens and determination of tensile strength of impregnated rovings《纺织玻璃纤维 粗纱 试样的制备和浸渍粗纱拉伸强度的测定》.pdf BS EN ISO 9163-2005 Textile glass - Rovings - Manufacture of test specimens and determination of tensile strength of impregnated rovings《纺织玻璃纤维 粗纱 试样的制备和浸渍粗纱拉伸强度的测定》.pdf
  • BS EN ISO 9168-2009 Dentistry - Hose connectors for air driven dental handpieces《牙科 气动牙科手持吸液器软管连结器》.pdf BS EN ISO 9168-2009 Dentistry - Hose connectors for air driven dental handpieces《牙科 气动牙科手持吸液器软管连结器》.pdf
  • BS EN ISO 9169-2006 Air quality - Definition and determination of performance characteristics of an automatic measuring system《空气质量 定义和确认自动测量系统的性能特性》.pdf BS EN ISO 9169-2006 Air quality - Definition and determination of performance characteristics of an automatic measuring system《空气质量 定义和确认自动测量系统的性能特性》.pdf
  • BS EN ISO 9170-1-2008 Terminal units for medical gas pipeline systems - Terminal units for use with compressed medical gases and vacuum《医疗气体管道系统用终端设备 医疗压缩气体和真空用终端设备》.pdf BS EN ISO 9170-1-2008 Terminal units for medical gas pipeline systems - Terminal units for use with compressed medical gases and vacuum《医疗气体管道系统用终端设备 医疗压缩气体和真空用终端设备》.pdf
  • BS EN ISO 9170-2-2008 Terminal units for medical gas pipeline systems - Terminal units for anaesthetic gas scavenging systems《医用气体管道系统用终端设备 麻醉气体清除系统用终端设备》.pdf BS EN ISO 9170-2-2008 Terminal units for medical gas pipeline systems - Terminal units for anaesthetic gas scavenging systems《医用气体管道系统用终端设备 麻醉气体清除系统用终端设备》.pdf
  • BS EN ISO 9173-1-2016 Dentistry Extraction forceps General requirements《牙科学 拔牙钳 一般要求和试验方法》.pdf BS EN ISO 9173-1-2016 Dentistry Extraction forceps General requirements《牙科学 拔牙钳 一般要求和试验方法》.pdf
  • BS EN ISO 9173-2-2010 Dentistry - Extraction forceps - Designation《牙科学 拔牙钳 命名法》.pdf BS EN ISO 9173-2-2010 Dentistry - Extraction forceps - Designation《牙科学 拔牙钳 命名法》.pdf
  • 相关搜索

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

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