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

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

1、三级数据库技术-533 及答案解析(总分:100.00,做题时间:90 分钟)一、设计与应用题(总题数:1,分数:100.00)1.函数 RData()实现从文件 in.dat中读取一篇英文文章存入到字符串数组 original中,请编写函数StrCharMove(),其函数的功能是:以行为单位把字符串中所有字符的 ASCII值右移 4位,然后把右移后的字符 ASCII值再加上原字符的 ASCII值,得到新的字符仍存入原字符串对应的位置上。最后把已处理的字符串仍按行重新存入字符串数组 original中,最后调用函数 WData(),把结果 original输出到文件out.dat中。 原始数

2、据文件存放的格式是:每行的宽度均小于 80个字符(含标点符号和空格)。 请勿改动主函数 main()、读数据函数 RData()和输出数据函数 WData()的内容。 #include stdio.h #include string.h #include conio.h char original 50 80; int maxline=0; int RData (void); void WData(void); void StrCharMove() void main() RData (); StrCharMove (); WData (); /*从文件 in.dat中读取一篇英文文章存入到字

3、符串数组 xx中*/ int RData (void FILE *fp; int i=0; char *p; if (fp=fopen(“in.dat“, “r“) = NULL) return 1; while (fgets(originali, 80, fp)!= NULL) p=strchr(originali, “n“); if (p) *p=0; i+; maxline=i; fclose(fp); return 0; /*把结果 original输出到文件 out.dat中*/ void WData() FILE *fp; int i; fp=fopen(“out.dat“, “w

4、); for (i=0; imaxline; i+) printf(“%sn“, originali); fprintf(fp,“%sn“, originali); fclose(fp); (分数:100.00)_三级数据库技术-533 答案解析(总分:100.00,做题时间:90 分钟)一、设计与应用题(总题数:1,分数:100.00)1.函数 RData()实现从文件 in.dat中读取一篇英文文章存入到字符串数组 original中,请编写函数StrCharMove(),其函数的功能是:以行为单位把字符串中所有字符的 ASCII值右移 4位,然后把右移后的字符 ASCII值再加上原字符

5、的 ASCII值,得到新的字符仍存入原字符串对应的位置上。最后把已处理的字符串仍按行重新存入字符串数组 original中,最后调用函数 WData(),把结果 original输出到文件out.dat中。 原始数据文件存放的格式是:每行的宽度均小于 80个字符(含标点符号和空格)。 请勿改动主函数 main()、读数据函数 RData()和输出数据函数 WData()的内容。 #include stdio.h #include string.h #include conio.h char original 50 80; int maxline=0; int RData (void); voi

6、d WData(void); void StrCharMove() void main() RData (); StrCharMove (); WData (); /*从文件 in.dat中读取一篇英文文章存入到字符串数组 xx中*/ int RData (void FILE *fp; int i=0; char *p; if (fp=fopen(“in.dat“, “r“) = NULL) return 1; while (fgets(originali, 80, fp)!= NULL) p=strchr(originali, “n“); if (p) *p=0; i+; maxline=i

7、 fclose(fp); return 0; /*把结果 original输出到文件 out.dat中*/ void WData() FILE *fp; int i; fp=fopen(“out.dat“, “w“); for (i=0; imaxline; i+) printf(“%sn“, originali); fprintf(fp,“%sn“, originali); fclose(fp); (分数:100.00)_正确答案:()解析:int i, j.strl; for (i=0; imaxline; i+) strl=strlen (original i); /计算字符串 ori

8、ginali的长度 for (j=0; jstrl; j+) /*把字符 original i j的 ASCII码值右移 4位后所得到的值与原字符 originalij的 ASCII码值相中,仍存入原字符串对应的位置上*/ originali j += originali j4; 解析 以行为单位把所有字符的 ASCII值右移 4位,后把右移后的字符 ASCII值再加上原字符的ASCII值,得到新的字符。 首先定义循环变量 i、j 和表示字符串长度的整型变量 strl。 在第一层 for循环中,循环变量 i从 0开始,依次递增直到其值等于或大于 maxline,在循环体中,首先用函数 strlen(originali)计算字符串 originali的长度,把这个值赋给整型变量 strl。在第二层for循环中,循环变量 i从 0开始,依次递增直到其值等于或大于 strl,利用表达式 originalij+=originalij4 实现对字符 originalij的 ASCII码值右移 4位后所得到值与原字符originalij的 ASCII码值相加,仍存入原字符串对应的位置上的功能。

展开阅读全文
相关资源
猜你喜欢
  • DIN EN 2213-2012 Aerospace series - Steel FE-PL1505 (15CrMoV6) - Air melted - Hardened and tempered - Bars - D 16 mm - 980 MPa R 1 180 MPa German and English version EN 2213 2012《航.pdf DIN EN 2213-2012 Aerospace series - Steel FE-PL1505 (15CrMoV6) - Air melted - Hardened and tempered - Bars - D 16 mm - 980 MPa R 1 180 MPa German and English version EN 2213 2012《航.pdf
  • DIN EN 2226-2015 Aerospace series - Steel X105CrMo17 (1 4125) - Hardened and tempered - Hand and die forgings - De = 150 mm German and English version EN 2226 2014《航空航天系列 X105CrMo1.pdf DIN EN 2226-2015 Aerospace series - Steel X105CrMo17 (1 4125) - Hardened and tempered - Hand and die forgings - De = 150 mm German and English version EN 2226 2014《航空航天系列 X105CrMo1.pdf
  • DIN EN 2235-2015 Aerospace series - Single and multicore electrical cables screened and jacketed - Technical specification German and English version EN 2235 2015《航空航天系列 带外屏蔽套的单芯和多.pdf DIN EN 2235-2015 Aerospace series - Single and multicore electrical cables screened and jacketed - Technical specification German and English version EN 2235 2015《航空航天系列 带外屏蔽套的单芯和多.pdf
  • DIN EN 2236-1992 Aerospace series pins shear headed close tolerance shank alloy steel technical specification german version EN 2236 1992《航空航天系列 合金钢的紧公差杆带头的抗剪销钉 技术规范》.pdf DIN EN 2236-1992 Aerospace series pins shear headed close tolerance shank alloy steel technical specification german version EN 2236 1992《航空航天系列 合金钢的紧公差杆带头的抗剪销钉 技术规范》.pdf
  • DIN EN 2240-001-2010 Aerospace series - Lamps incandescent - Part 001 Technical specification German and English version EN 2240-001 2009《航空航天系列 白炽灯 第001部分 技术规范 德文和英文版本EN 2240-001-.pdf DIN EN 2240-001-2010 Aerospace series - Lamps incandescent - Part 001 Technical specification German and English version EN 2240-001 2009《航空航天系列 白炽灯 第001部分 技术规范 德文和英文版本EN 2240-001-.pdf
  • DIN EN 2240-002-2010 Aerospace series - Lamps incandescent - Part 002 Main characteristics German and English version EN 2240-002 2009《航空航天系列 白炽灯 第002部分 主要特征 德文和英文版本EN 2240-002-200.pdf DIN EN 2240-002-2010 Aerospace series - Lamps incandescent - Part 002 Main characteristics German and English version EN 2240-002 2009《航空航天系列 白炽灯 第002部分 主要特征 德文和英文版本EN 2240-002-200.pdf
  • DIN EN 2240-003-2010 Aerospace series - Lamps incandescent - Part 003 Lamp code 44 - Product standard German and English version EN 2240-003 2010《航空航天系列 白炽灯 第003部分 灯 编码44 产品标准 德文和英.pdf DIN EN 2240-003-2010 Aerospace series - Lamps incandescent - Part 003 Lamp code 44 - Product standard German and English version EN 2240-003 2010《航空航天系列 白炽灯 第003部分 灯 编码44 产品标准 德文和英.pdf
  • DIN EN 2240-004-2010 Aerospace series - Lamps incandescent - Part 004 Lamp code 47 - Product standard German and English version EN 2240-004 2010《航空航天系列 白炽灯 第004部分 灯 编码47 产品标准 德文和英.pdf DIN EN 2240-004-2010 Aerospace series - Lamps incandescent - Part 004 Lamp code 47 - Product standard German and English version EN 2240-004 2010《航空航天系列 白炽灯 第004部分 灯 编码47 产品标准 德文和英.pdf
  • DIN EN 2240-005-2010 Aerospace series - Lamps incandescent - Part 005 Lamp code 73 - Product standard German and English version EN 2240-005 2009《航空航天系列 白炽灯 第005部分 灯、代码73 产品标准 德文和英.pdf DIN EN 2240-005-2010 Aerospace series - Lamps incandescent - Part 005 Lamp code 73 - Product standard German and English version EN 2240-005 2009《航空航天系列 白炽灯 第005部分 灯、代码73 产品标准 德文和英.pdf
  • 相关搜索

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

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