【计算机类职业资格】三级信息管理技术机试-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;若不是,则将其改成该字母的上一个字母。本题中不是小写字母的不作处理。

展开阅读全文
相关资源
猜你喜欢
  • BS ISO 6561-1-2005 Fruits vegetables and derived products - Determination of cadmium content - Method using graphite furnace atomic absorption spectrometry《水果、蔬菜及其制品 镉含量测定 石墨炉原子吸收光.pdf BS ISO 6561-1-2005 Fruits vegetables and derived products - Determination of cadmium content - Method using graphite furnace atomic absorption spectrometry《水果、蔬菜及其制品 镉含量测定 石墨炉原子吸收光.pdf
  • BS ISO 6561-2-2005 Fruits vegetables and derived products - Determination of cadmium content - Method using flame atomic absorption spectrometry《水果、蔬菜及其制品 镉含量测定 火焰原子吸收光谱测定法》.pdf BS ISO 6561-2-2005 Fruits vegetables and derived products - Determination of cadmium content - Method using flame atomic absorption spectrometry《水果、蔬菜及其制品 镉含量测定 火焰原子吸收光谱测定法》.pdf
  • BS ISO 6565-2015 Tobacco and tobacco products Draw resistance of cigarettes and pressure drop of filter rods Standard conditions and measurement《烟草和烟草制品 吸烟阻抗和滤棒的压力下降 标准条件和测量》.pdf BS ISO 6565-2015 Tobacco and tobacco products Draw resistance of cigarettes and pressure drop of filter rods Standard conditions and measurement《烟草和烟草制品 吸烟阻抗和滤棒的压力下降 标准条件和测量》.pdf
  • BS ISO 6576-2004 Laurel (Laurus nobilis L ) - Whole and ground leaves《月桂(Laurus nobilis Linnaeus) 整叶和碎叶》.pdf BS ISO 6576-2004 Laurel (Laurus nobilis L ) - Whole and ground leaves《月桂(Laurus nobilis Linnaeus) 整叶和碎叶》.pdf
  • BS ISO 6588-1-2012 Paper board and pulps Determination of pH of aqueous extracts Cold extraction《纸、纸板和纸浆 水提取物pH值的测定 冷萃取》.pdf BS ISO 6588-1-2012 Paper board and pulps Determination of pH of aqueous extracts Cold extraction《纸、纸板和纸浆 水提取物pH值的测定 冷萃取》.pdf
  • BS ISO 6588-2-2012 Paper board and pulps Determination of pH of aqueous extracts Hot extraction《纸、纸板和纸浆 水提物pH值的测定 热萃取》.pdf BS ISO 6588-2-2012 Paper board and pulps Determination of pH of aqueous extracts Hot extraction《纸、纸板和纸浆 水提物pH值的测定 热萃取》.pdf
  • BS ISO 6605-2017 Hydraulic fluid power Test methods for hoses and hose assemblies《液压传动 软管及软管组件的试验方法》.pdf BS ISO 6605-2017 Hydraulic fluid power Test methods for hoses and hose assemblies《液压传动 软管及软管组件的试验方法》.pdf
  • BS ISO 6611-2004 Milk and milk products - Enumeration of colony-forming units of yeasts and or moulds - Colony-count technique at 25 C《乳和乳制品 酵母和(或)霉菌菌落形成单位的计数 25℃时的菌落计数技术》.pdf BS ISO 6611-2004 Milk and milk products - Enumeration of colony-forming units of yeasts and or moulds - Colony-count technique at 25 C《乳和乳制品 酵母和(或)霉菌菌落形成单位的计数 25℃时的菌落计数技术》.pdf
  • BS ISO 6621-4-2015 Internal combustion engines Piston rings General specifications《内燃机 活塞环 一般规范》.pdf BS ISO 6621-4-2015 Internal combustion engines Piston rings General specifications《内燃机 活塞环 一般规范》.pdf
  • 相关搜索

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

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