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

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

1、计算机三级数据库技术-106 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.在文件 IN.DAT中存有 200个正整数,且每个正整数均在 10009999 之间。函数 readDat()的功能是读取这 200个数并存放到数组 aa中。请编写函数 jsSort(),该函数的功能是:按照每个数的后 3位的大小顺序进行升序排列,将排序后的前 10个数存入数组 bb中,如果数组 bb中出现后 3位相等的数,则对这些数按原始 4位数据大小顺序进行降序排列。最后调用函数 writeDat()把结果 bb输出到文件 OUT.DAT中。例如,处理前 60

2、12 5099 9012 7025 8088 处理后 9012 6012 7025 8088 5099 请勿改动主函数 main()、读函数 readDat()和写函数 writeDat()的内容。 试题程序 #includestdio.h #includestring.h #includestdlib.h int aa200,bb10; void readDat(); void writeDat(); void jsSort() void main() reactDat(); jsSort(); writeDat(); void readDat() FILE*in; int i; in=fo

3、pen(“IN.DAT“,“r“); for(i=0;i200;i+) fscanf(in,“%d“, fclose(in); void writeDat() FILE*out; int i; system(“CLS“); out=fopen(“OUT.DAT“,“w“); for(i=0;i10;i+) printf(“i=%d,%dn“,i+1,bbi); fprintf(out,“%dn“,bbi); fclose(out); (分数:100.00)_计算机三级数据库技术-106 答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.在文件

4、IN.DAT中存有 200个正整数,且每个正整数均在 10009999 之间。函数 readDat()的功能是读取这 200个数并存放到数组 aa中。请编写函数 jsSort(),该函数的功能是:按照每个数的后 3位的大小顺序进行升序排列,将排序后的前 10个数存入数组 bb中,如果数组 bb中出现后 3位相等的数,则对这些数按原始 4位数据大小顺序进行降序排列。最后调用函数 writeDat()把结果 bb输出到文件 OUT.DAT中。例如,处理前 6012 5099 9012 7025 8088 处理后 9012 6012 7025 8088 5099 请勿改动主函数 main()、读函数

5、 readDat()和写函数 writeDat()的内容。 试题程序 #includestdio.h #includestring.h #includestdlib.h int aa200,bb10; void readDat(); void writeDat(); void jsSort() void main() reactDat(); jsSort(); writeDat(); void readDat() FILE*in; int i; in=fopen(“IN.DAT“,“r“); for(i=0;i200;i+) fscanf(in,“%d“, fclose(in); void w

6、riteDat() FILE*out; int i; system(“CLS“); out=fopen(“OUT.DAT“,“w“); for(i=0;i10;i+) printf(“i=%d,%dn“,i+1,bbi); fprintf(out,“%dn“,bbi); fclose(out); (分数:100.00)_正确答案:()解析:void jsSort() int i,j; /*定义循环控制变量*/ int temp; /*定义数据交换时的暂存变量*/ for(i=0;i199;i+) /*选择法对数组进行排序*/ for(j=i+1;j200;j+) if(aai%1000aaj%

7、1000) /*按照每个数的后 3位的大小进行升序排列*/ temp=aai; aai=aaj; aaj=temp; else if(aai%1000=aaj%1000) /*如果后 3位数值相等*/ if(aaiaaj) /*则要按原 4位数的值进行降序排列*/ temp=aai; aai=aaj; aaj=temp; for(i=0;i10;i+) /*将排好序的前十个数存入数组 bb中*/ bbi=aai; 考点 本题考查对 4位数的排序。考查的知识点主要包括:数组元素的排序算法,if 判断语句和逻辑表达式,以及求余算术运算。 此题属于 4位数排序问题。分析题干要求,本题要求实现 jsSort()函数的功能,分析后可以归纳出 3个关键点:关键点 1如何取 4位数的后 3位进行比较;关键点 2按照每个数的后 3位的大小进行升序排列;关键点 3如果后 3位相等,则按照原始 4位数的大小进行降序排列。 接着分析每一步的解决方法,对于关键点 1可以通过算术运算的取余运算实现;第 2、3 点可通过包含 if判断语句的起泡排序算法完成。

展开阅读全文
相关资源
猜你喜欢
  • CNS 14954-2005 Principle aspects of functional evaluation of electrical insulation systems - Ageing mechanisms and diagnostic procedures《电气绝缘系统功能评估之原则性观点-老化历程与诊断程序》.pdf CNS 14954-2005 Principle aspects of functional evaluation of electrical insulation systems - Ageing mechanisms and diagnostic procedures《电气绝缘系统功能评估之原则性观点-老化历程与诊断程序》.pdf
  • CNS 14955-2005 Guide for the preparation of test procedures for evaluating the thermal endurance of electrical insulation systems《电气绝缘系统之耐热性评估试验程序先导指引》.pdf CNS 14955-2005 Guide for the preparation of test procedures for evaluating the thermal endurance of electrical insulation systems《电气绝缘系统之耐热性评估试验程序先导指引》.pdf
  • CNS 14956-2005 Performance evaluation of insulation systems based on service experience and functional tests《基于使用经验与功能试验之绝缘系统性能评估》.pdf CNS 14956-2005 Performance evaluation of insulation systems based on service experience and functional tests《基于使用经验与功能试验之绝缘系统性能评估》.pdf
  • CNS 14957-2005 Thermal evaluation and classification of electrical insulation《电气绝缘之耐热性评估与分级》.pdf CNS 14957-2005 Thermal evaluation and classification of electrical insulation《电气绝缘之耐热性评估与分级》.pdf
  • CNS 14958-1-2005 Human exposure to radio frequency fields from hand-held and body-mounted wireless communication devices – Human models instrumentation and procedures – Part 1 Pro .pdf CNS 14958-1-2005 Human exposure to radio frequency fields from hand-held and body-mounted wireless communication devices – Human models instrumentation and procedures – Part 1 Pro .pdf
  • CNS 14959-2005 Limits for exposuring to time-varying electric magnetic and electromagnetic fields (up to 300 GHz)《时变电场、磁场及电磁场曝露之限制值(300GHZ以下)》.pdf CNS 14959-2005 Limits for exposuring to time-varying electric magnetic and electromagnetic fields (up to 300 GHz)《时变电场、磁场及电磁场曝露之限制值(300GHZ以下)》.pdf
  • CNS 1496-2008 Textiles - Colour fastness to perspiration《耐汗色牢度试验法》.pdf CNS 1496-2008 Textiles - Colour fastness to perspiration《耐汗色牢度试验法》.pdf
  • CNS 14960-2005 28《铁矿石-依筛分之 确植疾舛ǚ》.pdf CNS 14960-2005 28《铁矿石-依筛分之 确植疾舛ǚ》.pdf
  • CNS 14962-2005 Gas cylinders - Valve protection caps and valve guard for industrial and medical gas cylinders - Design construction and tests《气体钢瓶-工业与医疗气体钢瓶之阀保护帽与阀保护套-设计、结构与试验》.pdf CNS 14962-2005 Gas cylinders - Valve protection caps and valve guard for industrial and medical gas cylinders - Design construction and tests《气体钢瓶-工业与医疗气体钢瓶之阀保护帽与阀保护套-设计、结构与试验》.pdf
  • 相关搜索

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

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