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

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

1、三级数据库技术-491 及答案解析(总分:100.00,做题时间:90 分钟)一、设计与应用题(总题数:1,分数:100.00)1.函数 ReadDat()实现从文件 in.dat 中读取一篇英文文章,存入到字符串数组 xx 中;请编制函数encryptChar(),按给定的替代关系对数组 xx 中的所有字符进行替代,仍存入数组 xx 对应的位置上,最后调用函数 WriteDat()把结果 xx 输出到文件 out.dat 中。 替代关系:fl(p)=p*11 mod 256,mod 为取余运算,p 是数组 xx 中某一个字符的 ASCII 值,fl(p)是计算后的无符号整型值(注意:中间变量

2、定义成整型变量),如果原字符是小写字母或计算后 f(p)值小于等于32,则该字符不变,否则用 f(p)替代所对应的字符。 请勿改动主函数 main()、读函数 ReadDat()和输出函数 WriteDat()的内容。 #include stdio.h #include string.h #include ctype.h unsigned char xx5080; int maxline=0; /*文章的总行数*/ int ReadDat (void); void WriteDat (void); void encryptChar() unsigned int val; void main()

3、 if (ReadDat() printf(“数据文件 in.dat 不能打开!n007“); return; encryptChar(); WriteDat(); /*从文件 in.dat 中读取一篇英文文章, 存入到字符串数组 xx 中*/ int ReadDat (void) FILE *fp; int i=0; unsigned 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;

4、 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(“%sn“, xxi); fprintf(fp, “%sn“, xxi); fclose (fp); (分数:100.00)_三级数据库技术-491 答案解析(总分:100.00,做题时间:90 分钟)一、设计与应用题(总题数:1,分数:100.00)1.函数 ReadDat()实现从文件 in.dat 中读

5、取一篇英文文章,存入到字符串数组 xx 中;请编制函数encryptChar(),按给定的替代关系对数组 xx 中的所有字符进行替代,仍存入数组 xx 对应的位置上,最后调用函数 WriteDat()把结果 xx 输出到文件 out.dat 中。 替代关系:fl(p)=p*11 mod 256,mod 为取余运算,p 是数组 xx 中某一个字符的 ASCII 值,fl(p)是计算后的无符号整型值(注意:中间变量定义成整型变量),如果原字符是小写字母或计算后 f(p)值小于等于32,则该字符不变,否则用 f(p)替代所对应的字符。 请勿改动主函数 main()、读函数 ReadDat()和输出函

6、数 WriteDat()的内容。 #include stdio.h #include string.h #include ctype.h unsigned char xx5080; int maxline=0; /*文章的总行数*/ int ReadDat (void); void WriteDat (void); void encryptChar() unsigned int val; void main() if (ReadDat() printf(“数据文件 in.dat 不能打开!n007“); return; encryptChar(); WriteDat(); /*从文件 in.d

7、at 中读取一篇英文文章, 存入到字符串数组 xx 中*/ int ReadDat (void) FILE *fp; int i=0; unsigned 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 输出到文件 out.dat 中*/ void WriteDat (void) FILE *fp; int i; fp=f

8、open(“out.dat“, “w“); for(i=0; imaxline; i+) printf(“%sn“, xxi); fprintf(fp, “%sn“, xxi); fclose (fp); (分数:100.00)_正确答案:()解析:int i, j; for(i=0; imaxline; i+) for(j=0; j(int) strlen(xxi); j+) val=(xxij*11)%256; /*如果新的 ASCII 值不小于等于 32 且原字符不是小写字母,则用新的 ASCII 值对应的字符替代原有的字符*/ if(!(val=32 | (xxij=97 解析 字符替代 f(p)=p*11 mod 256,小于等于 32 或原字符的 ASCII 码是偶数不变,否则替换。 通过审题可以发现主要是排序条件的设置要求有所不同,参考答案的第 6 行,修改 if 条件语句的设置即可。另外,在源程序中已经定义了一个无符号变量 val,因此,在编写答案程序时,不需要再重新定义。

展开阅读全文
相关资源
猜你喜欢
  • NEN 11120-4-1993 Digital audio tape recorder reel-to-reel system using 6 3 mm magnetic tape for professional use Part 4 Magnetic tape properties definitions and methods of measurem.pdf NEN 11120-4-1993 Digital audio tape recorder reel-to-reel system using 6 3 mm magnetic tape for professional use Part 4 Magnetic tape properties definitions and methods of measurem.pdf
  • NEN 11122-1994 Still video folppy disk magnetic recording system (IEC 1122 1992)《IEC 1122-1992静止视频软盘磁性录制系统》.pdf NEN 11122-1994 Still video folppy disk magnetic recording system (IEC 1122 1992)《IEC 1122-1992静止视频软盘磁性录制系统》.pdf
  • NEN 11125-1993 Unused hydrocarbon-based insulating liquids for electrical purposes Test methods for evaluating the oxidation stability (IEC 1125 1992+C1 1992)《IEC 1125-1992+ C1-199.pdf NEN 11125-1993 Unused hydrocarbon-based insulating liquids for electrical purposes Test methods for evaluating the oxidation stability (IEC 1125 1992+C1 1992)《IEC 1125-1992+ C1-199.pdf
  • NEN 11129-1994 Alternating current earthing switches Induced current switching(iec 1129 1992)《IEC 1129-1992交流电接地开关 电流感应开关》.pdf NEN 11129-1994 Alternating current earthing switches Induced current switching(iec 1129 1992)《IEC 1129-1992交流电接地开关 电流感应开关》.pdf
  • NEN 11144-1993 Insulating liquids for electrical purposes Test method for the determination of oxygen index (IEC 1144 1992)《IEC 1144-1992 测定绝缘液体氧指数的试验方法》.pdf NEN 11144-1993 Insulating liquids for electrical purposes Test method for the determination of oxygen index (IEC 1144 1992)《IEC 1144-1992 测定绝缘液体氧指数的试验方法》.pdf
  • NEN 11150-1994 Alkaline secondary cells and batteries Sealed nickel-cadmium rechargeable monobloc batteries in button cell design (IEC 1150 1992+C1 1992)《IEC 1150-1992 + C1-1992 碱性.pdf NEN 11150-1994 Alkaline secondary cells and batteries Sealed nickel-cadmium rechargeable monobloc batteries in button cell design (IEC 1150 1992+C1 1992)《IEC 1150-1992 + C1-1992 碱性.pdf
  • NEN 11157-1993 Requirements for the declaration of the acoustic output of medical diagnostic ultrasonic equipment (IEC 1157 1992)《IEC 1157-1992 医疗诊断用超波设备的声输出说明要求》.pdf NEN 11157-1993 Requirements for the declaration of the acoustic output of medical diagnostic ultrasonic equipment (IEC 1157 1992)《IEC 1157-1992 医疗诊断用超波设备的声输出说明要求》.pdf
  • NEN 11161-1993 Ultrasonic power measurement in liquids in the frequency range 0 5 MHz to 25 MHz (IEC 1161 1992)《IEC 1161-1992 液体中频率范围为0 5MHz-25MHz超声波功率测量规范》.pdf NEN 11161-1993 Ultrasonic power measurement in liquids in the frequency range 0 5 MHz to 25 MHz (IEC 1161 1992)《IEC 1161-1992 液体中频率范围为0 5MHz-25MHz超声波功率测量规范》.pdf
  • NEN 11179-1994 Helican-scan digital composite video cassette recording system using 19 mm magnetic tape format D2 (NTSC PAL PAL-M) (IEC 1179 1993)《IEC 1179-1993 使用19mm磁带D2格式(NTSC,P.pdf NEN 11179-1994 Helican-scan digital composite video cassette recording system using 19 mm magnetic tape format D2 (NTSC PAL PAL-M) (IEC 1179 1993)《IEC 1179-1993 使用19mm磁带D2格式(NTSC,P.pdf
  • 相关搜索

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

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