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

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

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

2、成整型变量),如果原字符的 ASCII 值是偶数或计算后 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() void main() if(ReadDat()

3、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; fclose(fp); ret

4、urn 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)_三级数据库技术-490 答案解析(总分:100.00,做题时间:90 分钟)一、设计与应用题(总题数:1,分数:100.00)1.函数 ReadDat()实现从文件 in.dat 中读取一篇英文文章,存入到字符串数组 xx

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

6、内容。 #include stdio.h #include string.h #include ctype.h unsigned char xx5080; int maxline=0; /*文章的总行数*/ int ReadDat(void); void WriteDat(void); void encryptChar() void main() if(ReadDat() printf(“数据文件 in.dat 不能打开!n007“); return; encryptChar(); WriteDat(); /*从文件 in.dat 中读取一篇英文文章, 存入到字符串数组 xx 中*/ int

7、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=fopen(“out.dat“, “w“); for(i=0; imaxli

8、ne; i+) printf(“%sn“, xxi); fprintf(fp, “%sn“, xxi); fclose(fp); (分数:100.00)_正确答案:()解析:int i, j, val; for(i=0; imaxline; i+) for(j=0; j(int) strlen(xxi); j+) val=(xxij*11)%256; /*如果新的 ASCII 值不小于等于 32 且原字符的 ASCII 码不是偶数,则用新的 ASCII 值对应的字符替代原有的字符*/ if(!(val=32 | (xxij %2)=0) xxij=val; 解析 字符替代 f(p)=p*11 mod 256,小于等于 32 或原字符的 ASCII 码是偶数不变,否则替换。 通过审题可以发现主要是排序条件的设置要求有所不同,参考答案的第 6 行,修改 if 条件语句的设置即可。

展开阅读全文
相关资源
猜你喜欢
  • DIN ISO 9099-1990 Air-conditioning and ventilation of dry provision rooms on board ships design conditions and basis of calculations identical with ISO 9099 1987《船舶干燥设备间的空调和通风 设计条件.pdf DIN ISO 9099-1990 Air-conditioning and ventilation of dry provision rooms on board ships design conditions and basis of calculations identical with ISO 9099 1987《船舶干燥设备间的空调和通风 设计条件.pdf
  • DIN ISO 91-1-1984 Petroleum measurement tables part 1 tables based on reference temperatures of 15 C and 60 F《石油测量表 第1部分 根据参比温度为15℃和60F 的编制表》.pdf DIN ISO 91-1-1984 Petroleum measurement tables part 1 tables based on reference temperatures of 15 C and 60 F《石油测量表 第1部分 根据参比温度为15℃和60F 的编制表》.pdf
  • DIN ISO 9102-1992 Road vehicles compression-ignition engines screw-in injection nozzle holders types 24 25 and 26 Identical with ISO 9102 1990《道路车辆 压燃式发动机 24 25 26型螺丝拧入式喷嘴座》.pdf DIN ISO 9102-1992 Road vehicles compression-ignition engines screw-in injection nozzle holders types 24 25 and 26 Identical with ISO 9102 1990《道路车辆 压燃式发动机 24 25 26型螺丝拧入式喷嘴座》.pdf
  • DIN ISO 9119-1991 Cross-country skis binding mounting area requirements and test methods identical with ISO 9119 1990《越野滑雪板 连接安装面积 要求和试验方法》.pdf DIN ISO 9119-1991 Cross-country skis binding mounting area requirements and test methods identical with ISO 9119 1990《越野滑雪板 连接安装面积 要求和试验方法》.pdf
  • DIN ISO 9120-2005 Petroleum and related products - Determination of air-release properties of steam turbine and other oils - Impinger method (ISO 9120 1997)《石油及相关产品 汽轮机油和其他油的空气释放性能.pdf DIN ISO 9120-2005 Petroleum and related products - Determination of air-release properties of steam turbine and other oils - Impinger method (ISO 9120 1997)《石油及相关产品 汽轮机油和其他油的空气释放性能.pdf
  • DIN ISO 9136-1-2006 Abrasive grains - Determination of bulk density - Part 1 Macrogrits (ISO 9136-1 2004) English version of DIN ISO 9136-1 2006-03《磨料粒度 堆积密度的测定 粗磨粒(ISO 9136-1-2004.pdf DIN ISO 9136-1-2006 Abrasive grains - Determination of bulk density - Part 1 Macrogrits (ISO 9136-1 2004) English version of DIN ISO 9136-1 2006-03《磨料粒度 堆积密度的测定 粗磨粒(ISO 9136-1-2004.pdf
  • DIN ISO 9136-2-2000 Abrasive grains - Determination of bulk density - Part 2 Microgrits (ISO 9136-2 1999)《磨料粒度 堆积密度的测定 粗磨粒》.pdf DIN ISO 9136-2-2000 Abrasive grains - Determination of bulk density - Part 2 Microgrits (ISO 9136-2 1999)《磨料粒度 堆积密度的测定 粗磨粒》.pdf
  • DIN ISO 9141-1992 Road vehicle diagnostic systems requirements for interchange of digital information identical with ISO 9141 1989《道路车辆 诊断系统 数字信息互换要求》.pdf DIN ISO 9141-1992 Road vehicle diagnostic systems requirements for interchange of digital information identical with ISO 9141 1989《道路车辆 诊断系统 数字信息互换要求》.pdf
  • DIN ISO 9154-2008 Aerospace - Bolts with MJ threads made of heat-resistant nickel-based alloy strength class 1550 MPa - Procurement specification (ISO 9154 1999) Text in German and.pdf DIN ISO 9154-2008 Aerospace - Bolts with MJ threads made of heat-resistant nickel-based alloy strength class 1550 MPa - Procurement specification (ISO 9154 1999) Text in German and.pdf
  • 相关搜索

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

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