【计算机类职业资格】计算机三级(信息管理技术)上机考试27及答案解析.doc

上传人:sofeeling205 文档编号:1337217 上传时间:2019-10-17 格式:DOC 页数:2 大小:27KB
下载 相关 举报
【计算机类职业资格】计算机三级(信息管理技术)上机考试27及答案解析.doc_第1页
第1页 / 共2页
【计算机类职业资格】计算机三级(信息管理技术)上机考试27及答案解析.doc_第2页
第2页 / 共2页
亲,该文档总共2页,全部预览完了,如果喜欢就下载吧!
资源描述

1、计算机三级(信息管理技术)上机考试 27及答案解析(总分:-1.00,做题时间:90 分钟)1.在文件 IN3.DAT中有 200个正整数,且每个数均在 1000至 9999之间。函数 readDat()的功能是读取这200个数存放到数组 aa中。请编制函数 jsSort(),该函数的功能是:要求按每个数的后 3位的大小进行降序排列,将排序后的前 10个数存入数组 b中,如果数组 b中出现后 3位相等的数,则对这些数按原始4位数据进行升序排列。最后调用函数 writeDat()把结果 bb输出到文件 OUT3.DAT中。 例如:处理前 9012 5099 6012 7025 8088 处理后

2、5099 8088 7025 6012 9012 注意:部分源程序已给出。 请勿改动主函数 main()、读函数 readDat()和写函数 writeDat()的内容。 试题程序: #include #include #include int aa200, bb10; void jsSort() main() readDat(); jsSort(); writeDat(); readDat() FILE *in; int i; in = fopen(“IN3.DAT“, “r“); for(i = 0; i 200; i+) fscanf(in, “%d,“, fclose(in); wri

3、teDat() FILE *out; int i; out = fopen(“OUT3.DAT“, “w“); clrscr(); for (i = 0; i 10; i+) printf(“i=%d,%dn“, i + 1, bbi); fprintf(out, “%dn“, bbi); fclose(out); (分数:-1.00)_计算机三级(信息管理技术)上机考试 27答案解析(总分:-1.00,做题时间:90 分钟)1.在文件 IN3.DAT中有 200个正整数,且每个数均在 1000至 9999之间。函数 readDat()的功能是读取这200个数存放到数组 aa中。请编制函数 j

4、sSort(),该函数的功能是:要求按每个数的后 3位的大小进行降序排列,将排序后的前 10个数存入数组 b中,如果数组 b中出现后 3位相等的数,则对这些数按原始4位数据进行升序排列。最后调用函数 writeDat()把结果 bb输出到文件 OUT3.DAT中。 例如:处理前 9012 5099 6012 7025 8088 处理后 5099 8088 7025 6012 9012 注意:部分源程序已给出。 请勿改动主函数 main()、读函数 readDat()和写函数 writeDat()的内容。 试题程序: #include #include #include int aa200, b

5、b10; void jsSort() main() readDat(); jsSort(); writeDat(); readDat() FILE *in; int i; in = fopen(“IN3.DAT“, “r“); for(i = 0; i 200; i+) fscanf(in, “%d,“, fclose(in); writeDat() FILE *out; int i; out = fopen(“OUT3.DAT“, “w“); clrscr(); for (i = 0; i 10; i+) printf(“i=%d,%dn“, i + 1, bbi); fprintf(out

6、 “%dn“, bbi); fclose(out); (分数:-1.00)_正确答案:(void jsSort() int i,j,data; for(i=0;iaaj) /*则要按原 4位数的值进行从小到大的排序*/ data=aai;aai=aaj;aaj=data; for(i=0;i解析:本题实质上考的是对数组元素进行排序的问题。最容易理解的方法是选择法。选择法的基本思想是:依次用当前取得的元素和它后面的其他元素进行比较,比如要从大到小进行排序,则只要发现后面的元素中有比当前元素大的,就把刚发现的较大的元素与当前元素交换,这样做的目的是当与其后的所有元素都比较完后,可以保证当前位置的当前元素存放着最大数。按照同样的方法去取得次大数。由于本题中题目要求要对数组中的 4位数的后 3位进行排序,因此,要首先取得各个数的后 3位并做比较,“aai%1000”就可以得到每个数的后 3位。根据题意,对这些数按后 3位进行从大到小的排序。若后 3位数相等,则要按原 4位数的值进行从小到大的排序。

展开阅读全文
相关资源
猜你喜欢
  • DIN EN ISO 15236-2-2017 Steel cord conveyor belts - Part 2 Preferred belt types (ISO 15236-2 2017) German version EN ISO 15236-2 2017《衬钢丝绳芯传送带 第2部分 选用带类型(ISO 15236-2-2017) 德文版本EN I.pdf DIN EN ISO 15236-2-2017 Steel cord conveyor belts - Part 2 Preferred belt types (ISO 15236-2 2017) German version EN ISO 15236-2 2017《衬钢丝绳芯传送带 第2部分 选用带类型(ISO 15236-2-2017) 德文版本EN I.pdf
  • DIN EN ISO 15236-4-2004 Steel cord conveyor belts - Part 4 Vulcanized belt joints (ISO 15236-4 2004) German Version EN ISO 15236-4 2004《衬钢丝绳芯传送带 第4部分 硬化带接头》.pdf DIN EN ISO 15236-4-2004 Steel cord conveyor belts - Part 4 Vulcanized belt joints (ISO 15236-4 2004) German Version EN ISO 15236-4 2004《衬钢丝绳芯传送带 第4部分 硬化带接头》.pdf
  • DIN EN ISO 1524-2013 Paints varnishes and printing inks - Determination of fineness of grind (ISO 1524 2013) German version EN ISO 1524 2013《涂料、清漆和印刷油墨 研磨细度的测定(ISO 1524-2013) 德文版本E.pdf DIN EN ISO 1524-2013 Paints varnishes and printing inks - Determination of fineness of grind (ISO 1524 2013) German version EN ISO 1524 2013《涂料、清漆和印刷油墨 研磨细度的测定(ISO 1524-2013) 德文版本E.pdf
  • DIN EN ISO 15245-1-2013 Gas cylinders - Parallel threads for connection of valves to gas cylinders - Part 1 Specification (ISO 15245-1 2001 + Amd 1 2013) German version EN ISO 1524.pdf DIN EN ISO 15245-1-2013 Gas cylinders - Parallel threads for connection of valves to gas cylinders - Part 1 Specification (ISO 15245-1 2001 + Amd 1 2013) German version EN ISO 1524.pdf
  • DIN EN ISO 15245-2-2002 Gas cylinders - Parallel threads for connection of valves to gas cylinders - Part 2 Gauge inspection (ISO 15245-2 2001) German version EN ISO 15245-2 2001《储.pdf DIN EN ISO 15245-2-2002 Gas cylinders - Parallel threads for connection of valves to gas cylinders - Part 2 Gauge inspection (ISO 15245-2 2001) German version EN ISO 15245-2 2001《储.pdf
  • DIN EN ISO 15252-1-2000 Plastics - Epoxy powder moulding compounds (EP-PMCs) - Part 1 Designation system and basis for specifications (ISO 15252-1 1999) German version EN ISO 15252.pdf DIN EN ISO 15252-1-2000 Plastics - Epoxy powder moulding compounds (EP-PMCs) - Part 1 Designation system and basis for specifications (ISO 15252-1 1999) German version EN ISO 15252.pdf
  • DIN EN ISO 15252-2-2000 Plastics - Epoxy powder moulding compounds (EP-PMCs) - Part 2 Preparation of test specimens and determination of properties (ISO 15252-2 1999) German versio.pdf DIN EN ISO 15252-2-2000 Plastics - Epoxy powder moulding compounds (EP-PMCs) - Part 2 Preparation of test specimens and determination of properties (ISO 15252-2 1999) German versio.pdf
  • DIN EN ISO 15252-3-2000 Plastics - Epoxy powder moulding compounds (EP-PMCs) - Part 3 Requirements for selected moulding compounds (ISO 15252-3 1999) German version EN ISO 15252-3 .pdf DIN EN ISO 15252-3-2000 Plastics - Epoxy powder moulding compounds (EP-PMCs) - Part 3 Requirements for selected moulding compounds (ISO 15252-3 1999) German version EN ISO 15252-3 .pdf
  • DIN EN ISO 15253-2001 Ophthalmic optics and instruments - Optical devices for enhancing low-vision (ISO 15253 2000) German version EN ISO 15253 2000《眼科光学和仪器 提高弱视力的光学装置》.pdf DIN EN ISO 15253-2001 Ophthalmic optics and instruments - Optical devices for enhancing low-vision (ISO 15253 2000) German version EN ISO 15253 2000《眼科光学和仪器 提高弱视力的光学装置》.pdf
  • 相关搜索

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

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