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

展开阅读全文
相关资源
猜你喜欢
  • JUS B H8 090-1996 Petroleum and petroleum products - Determination oj vanadium content in special fuel oils - Spectrophotometric method《石油和石油产品 特殊燃油中钒含量的测定 分光光度法》.pdf JUS B H8 090-1996 Petroleum and petroleum products - Determination oj vanadium content in special fuel oils - Spectrophotometric method《石油和石油产品 特殊燃油中钒含量的测定 分光光度法》.pdf
  • JUS B H8 101-1982 Foundry means Moulding sand additivs Sampling and testing《锻造方法 型砂添加剂的取样和测试》.pdf JUS B H8 101-1982 Foundry means Moulding sand additivs Sampling and testing《锻造方法 型砂添加剂的取样和测试》.pdf
  • JUS B H8 150-1983 Crude petroleum and petroleum products Determination of water and sediment Centrifuge method《原油和石油产品中水和沉淀物的测定(离心法)》.pdf JUS B H8 150-1983 Crude petroleum and petroleum products Determination of water and sediment Centrifuge method《原油和石油产品中水和沉淀物的测定(离心法)》.pdf
  • JUS B H8 218-1979 Mineral oils Petter A V1engine testing《矿物油,彼得 A V1引擎检测》.pdf JUS B H8 218-1979 Mineral oils Petter A V1engine testing《矿物油,彼得 A V1引擎检测》.pdf
  • JUS B H8 232-1991 Electrical insulating oils - Method for the detection of corrosive sulphur《电绝缘油 硫腐蚀的检测方法》.pdf JUS B H8 232-1991 Electrical insulating oils - Method for the detection of corrosive sulphur《电绝缘油 硫腐蚀的检测方法》.pdf
  • JUS B H8 310-1984 Methods of ana ysis of coal and coke Determination of moisture in the analysis sample of coal by the direct volumetric method《煤和焦炭的分析方法 直接体积法测定煤的分析试样的水分含量的测定》.pdf JUS B H8 310-1984 Methods of ana ysis of coal and coke Determination of moisture in the analysis sample of coal by the direct volumetric method《煤和焦炭的分析方法 直接体积法测定煤的分析试样的水分含量的测定》.pdf
  • JUS B H8 311-1984 Methods of analysi$ of coal and coks Determination of moisture in the analysis sample of coal Direct gravimetric method《煤和焦炭的分析方法 煤分析试样中水分含量的测定 直接重量法》.pdf JUS B H8 311-1984 Methods of analysi$ of coal and coks Determination of moisture in the analysis sample of coal Direct gravimetric method《煤和焦炭的分析方法 煤分析试样中水分含量的测定 直接重量法》.pdf
  • JUS B H8 312-1984 Methods of ana!ysis of coal and coke Determination of ash《煤和焦炭的分析方法 灰分含量的测定》.pdf JUS B H8 312-1984 Methods of ana!ysis of coal and coke Determination of ash《煤和焦炭的分析方法 灰分含量的测定》.pdf
  • JUS B H8 313-1984 Methods of analysis of coal and coke Hard coal Determination of forms of sulphur《煤和焦炭的分析方法 测定硫在硬煤中的各种形态》.pdf JUS B H8 313-1984 Methods of analysis of coal and coke Hard coal Determination of forms of sulphur《煤和焦炭的分析方法 测定硫在硬煤中的各种形态》.pdf
  • 相关搜索

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

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