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

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

1、三级信息管理技术机试-269 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.函数 ReadDat()的功能是实现从文件 IN59.DAT 中读取一篇英文文章,并存入到字符串数组 xx 中。请编制函数 CovertCharD(),该函数的功能是:以行为单位把字符串中的所有小写字母改成该字母的上一个字母,如果是字母 a,则改成字母 z。大写字母仍为大写字母,小写字母仍为小写字母,其他字符不变。把已处理的字符串仍按行重新存人字符串数组 xx 中,最后调用函数 WriteDat()把结果 xx 输出到文件OUT59.DAT 中。例如:原文 Adb

2、 Bcdzaabck LLhj结果 Aca Bbcyzzabj LLgi原始数据文件存放的格式是:每行的宽度均小于 80 个字符,含标点符号和空格。注意:部分源程序已给出。请勿改动主函数 main()、读函数 ReadDat()和写函数 WriteDat()的内容。试题程序#includestdio.h#includestring.h#includestdlib.hchar xx5080;int maxline=0:int ReadDat(void);void WriteDat(void);void CovertCharD()voidmain()system(“CLS“);if(ReadDat

3、)printf(“数据文件 IN59.DAT 不能打开/n/007“);return;CovertCharD();WriteDat();int ReadDat()FILE*fp;int i=0;char*P;if(fp=fopen(“IN59.DAT“,“r“)=NULL)return 1;while(fgets(xxi,80,fp)!=NULL)P=strchr(xxi,);if(P)* P=0:i+;maxline=i;fclose(fp);return 0;void WriteDat(void)FILE*fp;int i;system(“CLS“);fp=fopen(“OUT59.DA

4、T“,“w“);for(i=0;imaxline;i+)printf(“%s/n“,xxi);fprintf(fp,“%s/n“,xxi);fclose(fp);(分数:100.00)_三级信息管理技术机试-269 答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.函数 ReadDat()的功能是实现从文件 IN59.DAT 中读取一篇英文文章,并存入到字符串数组 xx 中。请编制函数 CovertCharD(),该函数的功能是:以行为单位把字符串中的所有小写字母改成该字母的上一个字母,如果是字母 a,则改成字母 z。大写字母仍为大写字母,小写

5、字母仍为小写字母,其他字符不变。把已处理的字符串仍按行重新存人字符串数组 xx 中,最后调用函数 WriteDat()把结果 xx 输出到文件OUT59.DAT 中。例如:原文 Adb Bcdzaabck LLhj结果 Aca Bbcyzzabj LLgi原始数据文件存放的格式是:每行的宽度均小于 80 个字符,含标点符号和空格。注意:部分源程序已给出。请勿改动主函数 main()、读函数 ReadDat()和写函数 WriteDat()的内容。试题程序#includestdio.h#includestring.h#includestdlib.hchar xx5080;int maxline=

6、0:int ReadDat(void);void WriteDat(void);void CovertCharD()voidmain()system(“CLS“);if(ReadDat()printf(“数据文件 IN59.DAT 不能打开/n/007“);return;CovertCharD();WriteDat();int ReadDat()FILE*fp;int i=0;char*P;if(fp=fopen(“IN59.DAT“,“r“)=NULL)return 1;while(fgets(xxi,80,fp)!=NULL)P=strchr(xxi,);if(P)* P=0:i+;max

7、line=i;fclose(fp);return 0;void WriteDat(void)FILE*fp;int i;system(“CLS“);fp=fopen(“OUT59.DAT“,“w“);for(i=0;imaxline;i+)printf(“%s/n“,xxi);fprintf(fp,“%s/n“,xxi);fclose(fp);(分数:100.00)_正确答案:(void covertcharD()int i,j; /*定义循环控制变量*/int str; /*存储字符串的长度*/for(i=0;imaxline;i+) /*逐行获取字符串*/str=strlen(xxi); /*求得各行的字符长度*/for(j=0;jstr;j+) /*逐个取每个字符进行处理*/if(xxij=a /*如果是小写字母 a,就改成字母 z*/elsexxij-=1; /*其余的改成该字母的上一个字母*/)解析:解析 本题要对二维数组中的字符元素按行来处理,首先要求得当前行所包含的字符个数,然后才可以利用循环来依次访问该行中的所有字符。当遇到一个字符时,先判断该字符是否为小写字母,如果是,则进一步判断该字为是否是小写字母a,若是,则改写为小写字母z;若不是,则将其改成该字母的上一个字母。本题中不是小写字母的不作处理。

展开阅读全文
相关资源
猜你喜欢
  • DIN ISO 15171-1-2004 Connections for fluid power and general use - Hydraulic couplings for diagnostic purposes - Part 1 Coupling not for connection under pressure (ISO 15171-1 1999.pdf DIN ISO 15171-1-2004 Connections for fluid power and general use - Hydraulic couplings for diagnostic purposes - Part 1 Coupling not for connection under pressure (ISO 15171-1 1999.pdf
  • DIN ISO 15178-2001 Soil quality - Determination of total sulfur by dry combustion (ISO 15178 2000)《土壤质量 干烧法测定硫总含量》.pdf DIN ISO 15178-2001 Soil quality - Determination of total sulfur by dry combustion (ISO 15178 2000)《土壤质量 干烧法测定硫总含量》.pdf
  • DIN ISO 15226-2017 Technical product documentation - Life cycle model and allocation of documents (ISO 15226 1999)《技术产品文件 寿命周期模型和文件分配(ISO 15226-1999)》.pdf DIN ISO 15226-2017 Technical product documentation - Life cycle model and allocation of documents (ISO 15226 1999)《技术产品文件 寿命周期模型和文件分配(ISO 15226-1999)》.pdf
  • DIN ISO 15228-2006 Textile machinery and accessories - Profile reeds for air jet weaving machines - Dimensions (ISO 15228 2005) English version of DIN ISO 15228 2006-01《纺织机械和附件 喷气织.pdf DIN ISO 15228-2006 Textile machinery and accessories - Profile reeds for air jet weaving machines - Dimensions (ISO 15228 2005) English version of DIN ISO 15228 2006-01《纺织机械和附件 喷气织.pdf
  • DIN ISO 15242-3-2014 Rolling bearings - Measuring methods for vibration - Part 3 Radial spherical and tapered roller bearings with cylindrical bore and outside surface (ISO 15242-3.pdf DIN ISO 15242-3-2014 Rolling bearings - Measuring methods for vibration - Part 3 Radial spherical and tapered roller bearings with cylindrical bore and outside surface (ISO 15242-3.pdf
  • DIN ISO 15242-4-2014 Rolling bearings - Measuring methods for vibration - Part 4 Radial cylindrical roller bearings with cylindrical bore and outside surface (ISO 15242-4 2007)《滚动轴.pdf DIN ISO 15242-4-2014 Rolling bearings - Measuring methods for vibration - Part 4 Radial cylindrical roller bearings with cylindrical bore and outside surface (ISO 15242-4 2007)《滚动轴.pdf
  • DIN ISO 15312-2004 Rolling bearings - Thermal speed rating - Calculation and coefficients (ISO 15312 2003)《滚动轴承 热速率 计算和系数》.pdf DIN ISO 15312-2004 Rolling bearings - Thermal speed rating - Calculation and coefficients (ISO 15312 2003)《滚动轴承 热速率 计算和系数》.pdf
  • DIN ISO 15344-2006 Snowboard step-in bindings - Requirements and test methods (ISO 15344 2005) English version of DIN ISO 15344 2006-06《滑雪板装配 要求和试验方法》.pdf DIN ISO 15344-2006 Snowboard step-in bindings - Requirements and test methods (ISO 15344 2005) English version of DIN ISO 15344 2006-06《滑雪板装配 要求和试验方法》.pdf
  • DIN ISO 15375-2014 Medical infusion bottles - Suspension devices for multiple use - Requirements and test methods (ISO 15375 2010)《医用输液瓶 多用途悬吊装置 要求和试验方法 (ISO 15375-2010)》.pdf DIN ISO 15375-2014 Medical infusion bottles - Suspension devices for multiple use - Requirements and test methods (ISO 15375 2010)《医用输液瓶 多用途悬吊装置 要求和试验方法 (ISO 15375-2010)》.pdf
  • 相关搜索

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

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