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

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

1、三级数据库技术-489 及答案解析(总分:100.00,做题时间:90 分钟)一、设计与应用题(总题数:1,分数:100.00)1.函数 ReadDat()实现从文件 in.dat中读取一篇英文文章,存入到字符串数组 xx中;请编制函数encryptChar(),按给定的替代关系对数组 xx中的所有字符进行替代,仍存入数组 xx对应的位置上,最后调用函数 WriteDat()把结果 xx输出到文件 out.dat中。 替代关系:f(p)=p*13 mod 256,mod 为取余运算,p 是数组 xx中某一个字符的 ASCII值,f(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() void main() if(ReadDat() printf(“数据文件 in.dat不能打开!n007“);

3、 return; encryptChar(); WriteDat(); 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; void WriteDat(void) FILE *fp; int i; fp=fopen(“out.dat“, “w“); fo

4、r(i=0; imaxline; i+) printf(“%sn“, xxi); fprintf(fp, “%sn“, xxi); fclose(fp); (分数:100.00)_三级数据库技术-489 答案解析(总分:100.00,做题时间:90 分钟)一、设计与应用题(总题数:1,分数:100.00)1.函数 ReadDat()实现从文件 in.dat中读取一篇英文文章,存入到字符串数组 xx中;请编制函数encryptChar(),按给定的替代关系对数组 xx中的所有字符进行替代,仍存入数组 xx对应的位置上,最后调用函数 WriteDat()把结果 xx输出到文件 out.dat中。

5、替代关系:f(p)=p*13 mod 256,mod 为取余运算,p 是数组 xx中某一个字符的 ASCII值,f(p)是计算后的无符号整型值(注意:中间变量定义成整型变量),如果计算后 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 Wr

6、iteDat(void); void encryptChar() void main() if(ReadDat() printf(“数据文件 in.dat不能打开!n007“); return; encryptChar(); WriteDat(); 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

7、 fclose(fp); return 0; 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)_正确答案:()解析:int i, j, val; for(i=0; imaxline; i+) for(j=0; j(int) strlen(xxi); j+) val=(xxij*13)%256; if(!(val=32|(val%2)=0) xxij=val; 解析 字符替代 f(p)=p*13 mod 256,小于等于 32或 ASCII码是偶数不变,否则替换。 通过审题可以发现主要是排序条件的设置要求有所不同,参考答案的第 6行,修改 if条件语句的设置即可。

展开阅读全文
相关资源
猜你喜欢
  • KS P ISO TS 11139-2009 Sterilization of health care products-Vocabulary《保健品的消毒 词汇》.pdf KS P ISO TS 11139-2009 Sterilization of health care products-Vocabulary《保健品的消毒 词汇》.pdf
  • KS P ISO TS 16976-1-2010 Respiratory protective devices-Human factors-Part 1:Metabolic rates and respiratory flow rates《呼吸保护装置 人性因素 第1部分 代谢速率和呼吸流动速率》.pdf KS P ISO TS 16976-1-2010 Respiratory protective devices-Human factors-Part 1:Metabolic rates and respiratory flow rates《呼吸保护装置 人性因素 第1部分 代谢速率和呼吸流动速率》.pdf
  • KS P ISO TS 19979-2006 Ophthalmic optics-Contact lenses-Hygienic management of multipatient use trial contact lenses 《眼科光学 接触镜片 由多位患者试用的接触镜片的卫生管理》.pdf KS P ISO TS 19979-2006 Ophthalmic optics-Contact lenses-Hygienic management of multipatient use trial contact lenses 《眼科光学 接触镜片 由多位患者试用的接触镜片的卫生管理》.pdf
  • KS P ISO TS 20993-2009 Biological evaluation of medical devices-Guidance on a risk-management process《医用设备的生物评估 风险管理处理导则》.pdf KS P ISO TS 20993-2009 Biological evaluation of medical devices-Guidance on a risk-management process《医用设备的生物评估 风险管理处理导则》.pdf
  • KS P ISO TS 22367-2009 Medical laboratories-Reduction of error through risk management and continual improvement《医学实验室 通过风险管理和连续改进减少过失》.pdf KS P ISO TS 22367-2009 Medical laboratories-Reduction of error through risk management and continual improvement《医学实验室 通过风险管理和连续改进减少过失》.pdf
  • KS P ISO TS 22595-1-2009 Dentistry-Plant area equipment-Part 1:Suction systems《牙科 厂区面积设备 第1部分 吸入系统》.pdf KS P ISO TS 22595-1-2009 Dentistry-Plant area equipment-Part 1:Suction systems《牙科 厂区面积设备 第1部分 吸入系统》.pdf
  • KS P ISO TS 23810-2009 Cardiovascular implants and artificial organs-Checklist for preoperative extracorporeal circulation equipment setup《心血管植入物和人造器官 手术前体外循环设备的调试检查清》.pdf KS P ISO TS 23810-2009 Cardiovascular implants and artificial organs-Checklist for preoperative extracorporeal circulation equipment setup《心血管植入物和人造器官 手术前体外循环设备的调试检查清》.pdf
  • KS Q ISO 10001-2011 Quality management-Customer satisfaction-Guidelines for codes of conduct for organizations《质量管理 顾客满意度 组织管理的规范指南》.pdf KS Q ISO 10001-2011 Quality management-Customer satisfaction-Guidelines for codes of conduct for organizations《质量管理 顾客满意度 组织管理的规范指南》.pdf
  • KS Q ISO 10003-2011 Quality management-Customer satisfaction-Guidelines for dispute resolution external to organizations《质量管理 顾客满意度 外界与组织的争议解决指导原则》.pdf KS Q ISO 10003-2011 Quality management-Customer satisfaction-Guidelines for dispute resolution external to organizations《质量管理 顾客满意度 外界与组织的争议解决指导原则》.pdf
  • 相关搜索

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

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