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

展开阅读全文
相关资源
猜你喜欢
  • ANSI AIIM MS34-1990 Dimensions for Reels Used for 16 mm and 35 mm Microfilm《16mm和35mm缩微胶片上使用的卷轴尺寸》.pdf ANSI AIIM MS34-1990 Dimensions for Reels Used for 16 mm and 35 mm Microfilm《16mm和35mm缩微胶片上使用的卷轴尺寸》.pdf
  • ANSI AIIM MS35-1990 Recommended Practice for the Requirements and Characteristics of Original Documents That May Be Microfilmed《可能会被缩微胶片化的最初的黑白文件的要求和特性》.pdf ANSI AIIM MS35-1990 Recommended Practice for the Requirements and Characteristics of Original Documents That May Be Microfilmed《可能会被缩微胶片化的最初的黑白文件的要求和特性》.pdf
  • ANSI AIIM MS37-1988 Recommended Practice for Microphotography of Cartographic Materials (Includes Addendum 1996)《制图材料缩微照相的推荐实施规程》.pdf ANSI AIIM MS37-1988 Recommended Practice for Microphotography of Cartographic Materials (Includes Addendum 1996)《制图材料缩微照相的推荐实施规程》.pdf
  • ANSI AIIM MS38-1995 Standard Recommended Practice for the Microrecording of Engineering Graphics - Computer-Output Microfilm《工程制图缩微记录的推荐实施规程.计算机输出缩微胶片》.pdf ANSI AIIM MS38-1995 Standard Recommended Practice for the Microrecording of Engineering Graphics - Computer-Output Microfilm《工程制图缩微记录的推荐实施规程.计算机输出缩微胶片》.pdf
  • ANSI AIIM MS39-1987 Recommended Practice for Operational Procedures Quality Control and Inspection of Graphic Computer-Output Microforms《信息和图像管理.操作过程 图形计算机输出缩微版本的质量控制和检验操作规程》.pdf ANSI AIIM MS39-1987 Recommended Practice for Operational Procedures Quality Control and Inspection of Graphic Computer-Output Microforms《信息和图像管理.操作过程 图形计算机输出缩微版本的质量控制和检验操作规程》.pdf
  • ANSI AIIM MS4-1987 Flowchart Symbols and Their Use in Micrographics《在缩微制图中流程图符号及其使用》.pdf ANSI AIIM MS4-1987 Flowchart Symbols and Their Use in Micrographics《在缩微制图中流程图符号及其使用》.pdf
  • ANSI AIIM MS40-1987 Microfilm Computer Assisted Retrieval (CAR) Interface Commands《缩微胶片.计算机辅助检索(CAR)接口命令》.pdf ANSI AIIM MS40-1987 Microfilm Computer Assisted Retrieval (CAR) Interface Commands《缩微胶片.计算机辅助检索(CAR)接口命令》.pdf
  • ANSI AIIM MS41-1996 Dimensions of Unitized Microfilm Carriers and Apertures (Aperture Camera Copy and Image Cards)《整体缩微胶片承载器(缩微照相检索穿孔卡、摄相机、拷贝、和图像卡)》.pdf ANSI AIIM MS41-1996 Dimensions of Unitized Microfilm Carriers and Apertures (Aperture Camera Copy and Image Cards)《整体缩微胶片承载器(缩微照相检索穿孔卡、摄相机、拷贝、和图像卡)》.pdf
  • ANSI AIIM MS42-1989 Recommended Practice for the Expungement Deletion Correction or Amendment of Records on Microforms《信息和图像管理.缩微版本上记录的抹去 删除 改正或增加》.pdf ANSI AIIM MS42-1989 Recommended Practice for the Expungement Deletion Correction or Amendment of Records on Microforms《信息和图像管理.缩微版本上记录的抹去 删除 改正或增加》.pdf
  • 相关搜索

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

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