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

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

1、三级数据库技术机试-285 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.函数 readDat()的功能是从文件 in52dat 中读取 20 行数据存放到字符串数组 xx 中(每行字符串的长度均小于 80)。请编制函数 JsSort(),该函数的功能是:以行为单位对字符串变量的下标为奇数位置上的字符按其 ASCII 值从小到大的顺序进行排序,排序后的结果仍按行重新存入字符串数组 xx 中,最后调用函数 wfiteDat()把结果 xx 输出到文件 out52dat 中。例如: 位置 0 1 2 3 4 5 6 7源字符串 h S f e

2、 d c b a则处理后字符串 h a f c d e b g。注意:部分源程序已给出。请勿改动主函数 main()、读函数 readDat()和写函数 writeD6L()的内容。试题程序:#include#include#includechar XX2080;void isSort()void main()readDat();jsSort();writeDat();readDat()FILE *in;int i=0;char *p; in=fopen(“in52.dat“,“r“);while(i20 if(p) ap=0;i+;fclose(in);writeDat ( )FILE *o

3、ut;int i;out=fopen(“out52.dat“,“w“);clrscr();for(i=0;i20;i+)printf(“%s/n“,xxi);fprintf(out,“%s/n“,xxi);fclose(out);(分数:100.00)_三级数据库技术机试-285 答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.函数 readDat()的功能是从文件 in52dat 中读取 20 行数据存放到字符串数组 xx 中(每行字符串的长度均小于 80)。请编制函数 JsSort(),该函数的功能是:以行为单位对字符串变量的下标为奇数位

4、置上的字符按其 ASCII 值从小到大的顺序进行排序,排序后的结果仍按行重新存入字符串数组 xx 中,最后调用函数 wfiteDat()把结果 xx 输出到文件 out52dat 中。例如: 位置 0 1 2 3 4 5 6 7源字符串 h S f e d c b a则处理后字符串 h a f c d e b g。注意:部分源程序已给出。请勿改动主函数 main()、读函数 readDat()和写函数 writeD6L()的内容。试题程序:#include#include#includechar XX2080;void isSort()void main()readDat();jsSort()

5、;writeDat();readDat()FILE *in;int i=0;char *p; in=fopen(“in52.dat“,“r“);while(i20 if(p) ap=0;i+;fclose(in);writeDat ( )FILE *out;int i;out=fopen(“out52.dat“,“w“);clrscr();for(i=0;i20;i+)printf(“%s/n“,xxi);fprintf(out,“%s/n“,xxi);fclose(out);(分数:100.00)_正确答案:(void jsSort() int i,j,k,strl;char ch;for(

6、i=0;i20;i+) strl=strlen(xxi); /*求各行字符串的长度*/for(j=1;jstrl-2;j=j+2) /*将下标为奇数的字符按其 ASCII 值从小到大的顺序进行排序*/for(k=j+2;kstrl;k=k+2)if(xxijxxi k)ch=xxij;xxij=xxi k;xxik=ch;)解析:解析 本题考查的知识点如下:(1)二维数组的访问及下标控制。(1)数据的排序。在本题中,将数据存放在一个二维数组 xx 中。其中以行数为数组的第一个下标,以字符串的最大长度 80为其第二个下标。因为以行为字符串处理的单位,首先要使用函数 strlcn()求得每一行中字符的个数。只对字符串数组中下标为奇数的字符进行处理,可以从 xx01开始,若需要增加时都增加 2,则可实现只访问下标为奇数的数组元素。排序使用前面介绍的“选择排序法”。

展开阅读全文
相关资源
猜你喜欢
  • ITU-R RS 515-5-2012 Frequency bands and bandwidths used for satellite passive remote sensing《卫星被动式遥感用频段和频宽》.pdf ITU-R RS 515-5-2012 Frequency bands and bandwidths used for satellite passive remote sensing《卫星被动式遥感用频段和频宽》.pdf
  • ITU-R RS 516-1 FRENCH-1994 FEASIBILITY OF SHARING BETWEEN ACTIVE SENSORS USED ON EARTH EXPLORATION AND METEOROLOGICAL SATELLITES AND THE RADIOLOCATION SERVICE《用于地球探测和气象卫星以及无线定位业务的有.pdf ITU-R RS 516-1 FRENCH-1994 FEASIBILITY OF SHARING BETWEEN ACTIVE SENSORS USED ON EARTH EXPLORATION AND METEOROLOGICAL SATELLITES AND THE RADIOLOCATION SERVICE《用于地球探测和气象卫星以及无线定位业务的有.pdf
  • ITU-R RS 516-1 SPANISH-1994 FEASIBILITY OF SHARING BETWEEN ACTIVE SENSORS USED ON EARTH EXPLORATION AND METEOROLOGICAL SATELLITES AND THE RADIOLOCATION SERVICE《用于地球探测和气象卫星以及无线定位业务的.pdf ITU-R RS 516-1 SPANISH-1994 FEASIBILITY OF SHARING BETWEEN ACTIVE SENSORS USED ON EARTH EXPLORATION AND METEOROLOGICAL SATELLITES AND THE RADIOLOCATION SERVICE《用于地球探测和气象卫星以及无线定位业务的.pdf
  • ITU-R RS 516-1-1994 FEASIBILITY OF SHARING BETWEEN ACTIVE SENSORS USED ON EARTH EXPLORATION AND METEOROLOGICAL SATELLITES AND THE RADIOLOCATION SERVICE《用于地球探测和气象卫星以及无线定位业务的有源传感器之间共.pdf ITU-R RS 516-1-1994 FEASIBILITY OF SHARING BETWEEN ACTIVE SENSORS USED ON EARTH EXPLORATION AND METEOROLOGICAL SATELLITES AND THE RADIOLOCATION SERVICE《用于地球探测和气象卫星以及无线定位业务的有源传感器之间共.pdf
  • ITU-R RS 577-7 FRENCH-2009 Frequency bands and required bandwidths used for spaceborne active sensors operating in the Earth exploration-satellite (active) and space research (acti.pdf ITU-R RS 577-7 FRENCH-2009 Frequency bands and required bandwidths used for spaceborne active sensors operating in the Earth exploration-satellite (active) and space research (acti.pdf
  • ITU-R RS 577-7 SPANISH-2009 Frequency bands and required bandwidths used for spaceborne active sensors operating in the Earth exploration-satellite (active) and space research (act.pdf ITU-R RS 577-7 SPANISH-2009 Frequency bands and required bandwidths used for spaceborne active sensors operating in the Earth exploration-satellite (active) and space research (act.pdf
  • ITU-R RS 577-7-2009 Frequency bands and required bandwidths used for spaceborne active sensors operating in the Earth exploration-satellite (active) and space research (active) ser.pdf ITU-R RS 577-7-2009 Frequency bands and required bandwidths used for spaceborne active sensors operating in the Earth exploration-satellite (active) and space research (active) ser.pdf
  • ITU-R S 1001-2 SPANISH-2010 Use of systems in the fixed-satellite service in the event of natural disasters and similar emergencies for warning and relief operations《自然灾害和类似紧急事件发生时.pdf ITU-R S 1001-2 SPANISH-2010 Use of systems in the fixed-satellite service in the event of natural disasters and similar emergencies for warning and relief operations《自然灾害和类似紧急事件发生时.pdf
  • ITU-R S 1001-2-2010 Use of systems in the fixed-satellite service in the event of natural disasters and similar emergencies for warning and relief operations《在自然灾害及类似紧急事件中用于预警和救援行动.pdf ITU-R S 1001-2-2010 Use of systems in the fixed-satellite service in the event of natural disasters and similar emergencies for warning and relief operations《在自然灾害及类似紧急事件中用于预警和救援行动.pdf
  • 相关搜索

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

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