【计算机类职业资格】三级数据库技术-538及答案解析.doc

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

1、三级数据库技术-538 及答案解析(总分:100.00,做题时间:90 分钟)一、设计与应用题(总题数:1,分数:100.00)1.函数 ReadDat()实现从文件 in.dat 中读取一篇英文文章存入到字符串数组 xx 中,请编制函数ConvertCharA(),其函数的功能是:以行为单位把字符串中的所有小写字母改写成该字母的下一个字母,如果是字母 z,则改写成字母 a,大写字母和其他字符保持不变。把已处理的字符串仍按行重新存入字符串数组 xx 中。最后 main()函数调用函数 WriteDat()把结果 xx 输出到文件 out.dat 中。 例:原文:Adb.Bcdza abck.L

2、Lhj 结果:Aec.Bdeab bcdl.LLik 原始数据文件存放的格式是:每行的宽度均小于 80 个字符,含标点符号和空格。 请勿改动主函数 main()、读函数 ReadDat()和输出函数 WriteDat()的内容。 #include stdio.h #include string.h char xx50 80; int maxline=0; /*文章的总行数*/ int ReadDat (void); void WriteDat(void); void ConvertCharA(void) void main() if (ReadDat () printf(“数据文件 in.da

3、t 不能打开! n007“); return; ConvertCharA (); WriteDat (); /*从文件 in.dat 中读取一篇英文文章存入到字符串数组 xx 中*/ int ReadDat (void) FILE *fp; int i=0; char *p; if(fp= fopen ( “in.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; /*把结果 xx 输出到文件

4、 out.dat 中*/ void WriteDat(void) FILE *fp; int i; fp=fopen(“out.dat“, “w“); for(i=0; imaxline; i+) printf(“%skn“, xxi); fprintf(fp, “%sn“, xxi); fclose(fp); (分数:100.00)_三级数据库技术-538 答案解析(总分:100.00,做题时间:90 分钟)一、设计与应用题(总题数:1,分数:100.00)1.函数 ReadDat()实现从文件 in.dat 中读取一篇英文文章存入到字符串数组 xx 中,请编制函数ConvertCharA(

5、),其函数的功能是:以行为单位把字符串中的所有小写字母改写成该字母的下一个字母,如果是字母 z,则改写成字母 a,大写字母和其他字符保持不变。把已处理的字符串仍按行重新存入字符串数组 xx 中。最后 main()函数调用函数 WriteDat()把结果 xx 输出到文件 out.dat 中。 例:原文:Adb.Bcdza abck.LLhj 结果:Aec.Bdeab bcdl.LLik 原始数据文件存放的格式是:每行的宽度均小于 80 个字符,含标点符号和空格。 请勿改动主函数 main()、读函数 ReadDat()和输出函数 WriteDat()的内容。 #include stdio.h

6、include string.h char xx50 80; int maxline=0; /*文章的总行数*/ int ReadDat (void); void WriteDat(void); void ConvertCharA(void) void main() if (ReadDat () printf(“数据文件 in.dat 不能打开! n007“); return; ConvertCharA (); WriteDat (); /*从文件 in.dat 中读取一篇英文文章存入到字符串数组 xx 中*/ int ReadDat (void) FILE *fp; int i=0; ch

7、ar *p; if(fp= fopen ( “in.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; /*把结果 xx 输出到文件 out.dat 中*/ void WriteDat(void) FILE *fp; int i; fp=fopen(“out.dat“, “w“); for(i=0; imaxline; i+) printf(“%skn“, xxi); fprintf(fp,

8、sn“, xxi); fclose(fp); (分数:100.00)_正确答案:()解析:int i,j; /*以行为单位把字符串中的所有小写字母改写成该字母的下一个字母,如果是字母 z,则改写成字母 a,大写字母和其他字符保持不变*/ for(i=0;imaxline; i+) for(j=0;j(int)strlen(xxi);j+) if(xxij=“a“ /则把字母 a 赋给 xxij else xxij+; /否则,字符 xxij加 1,改写成其下一个字母 解析 以行为单位把字符串中的所有小写字母改写成该字母的下一个字母,大小写不变,其他字符不变。 定义整型循环变量 i、j。 在第一层 for 循环中,循环变量 i 从 0 开始,依次递增直到其值等于 maxline,实现对文章每行的处理。第二层 for 循环中,循环变量 j 从 0 开始,依次递增直到其值等于 strlen(xxi),在循环体中,利用 if条件语句首先判断 xxij的值是否在小写字符字符“a“z“之间,然后,再判断在此范围之内的小写字母,如果是“z“,则该字符转换为“a“,如果字符不是“z“,则将其改写成它的下一个字母。

展开阅读全文
相关资源
猜你喜欢
  • NF C92-304-1998 Methods of measurement on radio receivers for various classes of emission Part 4  receivers for frequency-modulated sound broadcasting emissions 《各种发射分级用无线电接收机的测量方法.pdf NF C92-304-1998 Methods of measurement on radio receivers for various classes of emission Part 4 receivers for frequency-modulated sound broadcasting emissions 《各种发射分级用无线电接收机的测量方法.pdf
  • NF C92-307-1996 Methods of measurement on radio receivers for various classes of emission Part 7  methods of measurement on digital satellite radio (dsr) receivers 《各种发射等级用无线电接收机的测.pdf NF C92-307-1996 Methods of measurement on radio receivers for various classes of emission Part 7 methods of measurement on digital satellite radio (dsr) receivers 《各种发射等级用无线电接收机的测.pdf
  • NF C92-412-1983 Radiotelephonic transmitters Receivers 26 960 MHzto 27 410 MHzband 《无线电话发射机 频带范围为 26 960 MHz - 27 410 MHz 的接收机》.pdf NF C92-412-1983 Radiotelephonic transmitters Receivers 26 960 MHzto 27 410 MHzband 《无线电话发射机 频带范围为 26 960 MHz - 27 410 MHz 的接收机》.pdf
  • NF C92-501-1998 Characteristics of DVB receivers 《DVB 接收机的特性》.pdf NF C92-501-1998 Characteristics of DVB receivers 《DVB 接收机的特性》.pdf
  • NF C92-502-1998 Digital Audio Broadcasting system Specification of the Receiver Data interface (RDI) 《数字音频广播系统 接收机数据接口(RDI)规范》.pdf NF C92-502-1998 Digital Audio Broadcasting system Specification of the Receiver Data interface (RDI) 《数字音频广播系统 接收机数据接口(RDI)规范》.pdf
  • NF C92-504-2001 Digital audio broadcasting system - Specification of the DAB command set for receiver (DCSR) 《数字音频广播系统 接收机 DAB 命令集规范》.pdf NF C92-504-2001 Digital audio broadcasting system - Specification of the DAB command set for receiver (DCSR) 《数字音频广播系统 接收机 DAB 命令集规范》.pdf
  • NF C92-507-2005 Video systems (625 50 progressive) - Video and accompanied data using the vertical blanking interval - Analogue interface 《视频系统(625 50改进的) 使用垂直消隐时间的视频和伴随数据 模拟接口》.pdf NF C92-507-2005 Video systems (625 50 progressive) - Video and accompanied data using the vertical blanking interval - Analogue interface 《视频系统(625 50改进的) 使用垂直消隐时间的视频和伴随数据 模拟接口》.pdf
  • NF C93-011-2005 Marking codes for resistors and capacitors 《电阻器和电容器标志代码》.pdf NF C93-011-2005 Marking codes for resistors and capacitors 《电阻器和电容器标志代码》.pdf
  • NF C93-022-1971 Components for electronic equipment Point to point clip terminal 《电子设备元件 点到点接线夹端子》.pdf NF C93-022-1971 Components for electronic equipment Point to point clip terminal 《电子设备元件 点到点接线夹端子》.pdf
  • 相关搜索

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

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