【计算机类职业资格】三级信息管理技术机试-268及答案解析.doc

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

1、三级信息管理技术机试-268 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.函数 ReadDat()的功能是实现从文件 IN62.DAT 中读取一篇英文文章,并存入到字符串数组 XX 中;请编制函数 StrCharJP(),该函数的功能是:以行为单位把字符串中的所有字符的 ASCII 值右移 4 位,然后把右移后的字符的 ASC值再加上原字符的 ASC值,得到新的字符,并存入原字符串对应的位置上。最后把已处理的字符串按行重新存入字符串数组 xx 中,并调用函数 WriteDat()把结果 xx 输出到文件OUT62.DAT 中。注意:部分

2、源程序已给出。原始数据文件存放的格式是:每行的宽度均小于 80 个字符,含标点符号和空格。请勿改动主函数 main()、读函数 ReadDat()和写函数 WfiteDat()的内容。试题程序#includestdio.h#includestring.h#includestdlib.hchar XX5080;int maxline=0;*文章的总行数*int ReadDat(void);void WriteDat(void);void StrCharJR(void)void main()system(“CLS“);if(ReadDat()printf(“数据文件 IN62.DAT 不能打开!/

3、n/007“);return;StrCharJR();WriteDat();int ReadDat(void)FILE*fp;int i=0;char*P;if(fp=fopen(“IN62.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;system(“CLS“);fp=fopen(“OUT62.DAT“,“W“);for(i=0;imaxline;i

4、)printf(“%S/n“,xxi);fprintf(fp,“%s/n“,xxi);fclose(fp);(分数:100.00)_三级信息管理技术机试-268 答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.函数 ReadDat()的功能是实现从文件 IN62.DAT 中读取一篇英文文章,并存入到字符串数组 XX 中;请编制函数 StrCharJP(),该函数的功能是:以行为单位把字符串中的所有字符的 ASCII 值右移 4 位,然后把右移后的字符的 ASC值再加上原字符的 ASC值,得到新的字符,并存入原字符串对应的位置上。最后把已处理

5、的字符串按行重新存入字符串数组 xx 中,并调用函数 WriteDat()把结果 xx 输出到文件OUT62.DAT 中。注意:部分源程序已给出。原始数据文件存放的格式是:每行的宽度均小于 80 个字符,含标点符号和空格。请勿改动主函数 main()、读函数 ReadDat()和写函数 WfiteDat()的内容。试题程序#includestdio.h#includestring.h#includestdlib.hchar XX5080;int maxline=0;*文章的总行数*int ReadDat(void);void WriteDat(void);void StrCharJR(void

6、)void main()system(“CLS“);if(ReadDat()printf(“数据文件 IN62.DAT 不能打开!/n/007“);return;StrCharJR();WriteDat();int ReadDat(void)FILE*fp;int i=0;char*P;if(fp=fopen(“IN62.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*f

7、p;int i;system(“CLS“);fp=fopen(“OUT62.DAT“,“W“);for(i=0;imaxline;i+)printf(“%S/n“,xxi);fprintf(fp,“%s/n“,xxi);fclose(fp);(分数:100.00)_正确答案:(void strcharJR(void)int i,j; *定义循环控制变量*int str: *存储字符串的长度*for(i=0;imaxline;i+) *以行为单位获取字符*str=strlen(xxi); *求得当前行的字符串长度*for(j=0;jstr;j+)xxij+=xxij0; *字符的 Asc值右移 4 位再加上原字符的 ASC值,得到新字符*/)解析:解析 本题考查对二维字符数组元素的操作。首先可以利用双重循环按照先行后列的顺序逐个取得数组中的字符,外层循环用来控制行数,内层循环用来依次取得各行中的每一个字符。之后对当前所取得的字符进行右移 4 位的运算(这里用到了“”右移运算符),最后把移后得到的字符累加到原字符中去,这样原来字符就可以被新的字符所覆盖。

展开阅读全文
相关资源
猜你喜欢
  • EN 61853-1-2011 en Photovoltaic (PV) module performance testing and energy rating - Part 1 Irradiance and temperature performance measurements and power rating《光电(PV)模块性能试验和能量率 第1部.pdf EN 61853-1-2011 en Photovoltaic (PV) module performance testing and energy rating - Part 1 Irradiance and temperature performance measurements and power rating《光电(PV)模块性能试验和能量率 第1部.pdf
  • EN 61853-2-2016 en Photovoltaic (PV) module performance testing and energy rating - Part 2 Spectral responsivity incidence angle and module operating temperature measurements.pdf EN 61853-2-2016 en Photovoltaic (PV) module performance testing and energy rating - Part 2 Spectral responsivity incidence angle and module operating temperature measurements.pdf
  • EN 61854-1998 en Overhead Lines - Requirements and Tests for Spacers《架空线 隔离棒的要求和试验 IEC 61854 1998》.pdf EN 61854-1998 en Overhead Lines - Requirements and Tests for Spacers《架空线 隔离棒的要求和试验 IEC 61854 1998》.pdf
  • EN 61855-2003 en Household electrical hair care appliances - Methods of measuring the performance《家用电动毛发护理用具 性能测量方法 IEC 61855 2003》.pdf EN 61855-2003 en Household electrical hair care appliances - Methods of measuring the performance《家用电动毛发护理用具 性能测量方法 IEC 61855 2003》.pdf
  • EN 61857-1-2009 en Electrical insulation systems - Procedures for thermal evaluation - Part 1 General requirements - Low-voltage《电气绝缘系统 热评定规程 第1部分 低电压的一般要求》.pdf EN 61857-1-2009 en Electrical insulation systems - Procedures for thermal evaluation - Part 1 General requirements - Low-voltage《电气绝缘系统 热评定规程 第1部分 低电压的一般要求》.pdf
  • EN 61857-21-2009 en Electrical insulation systems - Procedures for thermal evaluation - Part 21 Specific requirements for general-purpose models - Wire-wound applications《电气绝缘系统 热评.pdf EN 61857-21-2009 en Electrical insulation systems - Procedures for thermal evaluation - Part 21 Specific requirements for general-purpose models - Wire-wound applications《电气绝缘系统 热评.pdf
  • EN 61857-22-2008 en Electrical insulation systems - Procedures for thermal evaluation - Part 22 Specific requirements for encapsulated-coil model - Wire-wound electrical insulation.pdf EN 61857-22-2008 en Electrical insulation systems - Procedures for thermal evaluation - Part 22 Specific requirements for encapsulated-coil model - Wire-wound electrical insulation.pdf
  • EN 61857-31-2017 en Electrical insulation systems - Procedures for thermal evaluation - Part 31 Applications with a designed life of 5 000 h or less.pdf EN 61857-31-2017 en Electrical insulation systems - Procedures for thermal evaluation - Part 31 Applications with a designed life of 5 000 h or less.pdf
  • EN 61858-1-2014 en Electrical insulation systems - Thermal evaluation of modifications to an established electrical insulation system (EIS) - Part 1 Wire-wound winding EIS.pdf EN 61858-1-2014 en Electrical insulation systems - Thermal evaluation of modifications to an established electrical insulation system (EIS) - Part 1 Wire-wound winding EIS.pdf
  • 相关搜索

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

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