[计算机类试卷]计算机三级数据库技术(上机操作)机试模拟试卷46及答案与解析.doc

上传人:bonesoil321 文档编号:505578 上传时间:2018-11-29 格式:DOC 页数:3 大小:26.50KB
下载 相关 举报
[计算机类试卷]计算机三级数据库技术(上机操作)机试模拟试卷46及答案与解析.doc_第1页
第1页 / 共3页
[计算机类试卷]计算机三级数据库技术(上机操作)机试模拟试卷46及答案与解析.doc_第2页
第2页 / 共3页
[计算机类试卷]计算机三级数据库技术(上机操作)机试模拟试卷46及答案与解析.doc_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
资源描述

1、计算机三级数据库技术(上机操作)机试模拟试卷 46及答案与解析 一、程序设计题 1 函数 readDat()是从数据文件 in dat中读取 20行数据存放到字符串数组 xx中 (每行字符串长度均小于 80)。请编写函数 jsSort(),其函数的功能是:以行为单位对字符串按下面给定的条件进行排序,排序后的结果仍按行重新存入字符串数组 XX中。最后调用函数 writeDat()把结果 xx输出到文件 out dat中。条件;从字符串中间一分为二,左边部分按字符的 ASCII码值降序排序,右边部分不作处理。排序后,左边部分与右边 部分按例子所示进行交换。如果原字符串长度为奇数,则最中间的字符不参

2、加处理,字符仍放在原位置上。 例如:位置 0 1 2 3 4 5 6 7 8 原字符串 a h C d h g f e 1 2 3 4 9 8 7 6 5 处理后字符串 h g f e d C b f 8 7 6 5 9 4 3 2 1 【试题程序】 #include #includestring h char xxE2080; void readDat(); void writeDat(); void jsSort() *第 i行文章的内容已作为字符串存入 xxi为起始地址的存储单元内 * *提示:先对字符串左边部分的字符数组 进行降序排序左边部分字符数组对应的下标从 0到 strlen(x

3、xiJ) 2一 1。 * *该提示仅供解题参考,考生也可用其他方法解题 * void main() readDat(); jsSort(); writeDat(); void readDat() FILE*in; int i=0: char*P; in=fopen(“in dat”, “r”); while(i20 fgets(xxi, 80, in)!= NULL) p=strchr(xxi n); ir(p)*p=0; i+; fclose(in); void writeDat() FILE*out; int i; out=fopen(“out dat”, “w”); for(i=0; i

4、20; i+) printf(“ s n”。 xxi); fprintf(out, “ s n”, xxi); fclose(out); 计算机三级数据库技术(上机操作)机试模拟试卷 46答案与解析 一、程序设计题 1 【正确答案】 void jsSort() unsigned int i, j, k; *定义变量 * int temp; for(i=0;i20Ii+) for(j=0;jstrlen(xxi) 21; j+) *选择法排序 * for(k=j+1tkstrlen(xxi) 2Ik+) if(xxijxxik) temp=xxij; xxj=xxik; xxik=temp; for(j=0 1jstrlen(xxEi) 2; j+) *交换字符 * k=j+(strlen(xxi)+1) 2; temp=xxij; xxij=xxik; xxik=temp;

展开阅读全文
相关资源
猜你喜欢
  • ASHRAE LO-09-029-2009 Air Distribution Effectiveness with Stratified Air Distribution Systems《分层气流组织系统中气流组织效能的研究》.pdf ASHRAE LO-09-029-2009 Air Distribution Effectiveness with Stratified Air Distribution Systems《分层气流组织系统中气流组织效能的研究》.pdf
  • ASHRAE LO-09-030-2009 In-Situ Performance of Stratified Air Distribution Systems in Two Canadian Buildings《两个加拿大建筑中分层空气分配系统的原地性能》.pdf ASHRAE LO-09-030-2009 In-Situ Performance of Stratified Air Distribution Systems in Two Canadian Buildings《两个加拿大建筑中分层空气分配系统的原地性能》.pdf
  • ASHRAE LO-09-031-2009 Discussion of Design Method and Optimization on Airflow Distribution in a Large-Space Building with Stratified Air-Conditioning System《关于带有分层空调系统的大型建筑中气流分布的设计.pdf ASHRAE LO-09-031-2009 Discussion of Design Method and Optimization on Airflow Distribution in a Large-Space Building with Stratified Air-Conditioning System《关于带有分层空调系统的大型建筑中气流分布的设计.pdf
  • ASHRAE LO-09-032-2009 Contaminant Transport and Filtration Issues with DOAS《用DOAS垃圾运输和过滤处理问题》.pdf ASHRAE LO-09-032-2009 Contaminant Transport and Filtration Issues with DOAS《用DOAS垃圾运输和过滤处理问题》.pdf
  • ASHRAE LO-09-033-2009 Role of Safety Factors in the Design of Dedicated Outdoor-Air Systems《专用室外空气系统设计安全系数的作用》.pdf ASHRAE LO-09-033-2009 Role of Safety Factors in the Design of Dedicated Outdoor-Air Systems《专用室外空气系统设计安全系数的作用》.pdf
  • ASHRAE LO-09-034-2009 Building Heat Load Contributions from Medium and Low Voltage Switchgear-Part I Solid Rectangular Bus Bar Heat Losses《中低压开关的建筑热负载作用 第I部分 固体矩形母线热损失》.pdf ASHRAE LO-09-034-2009 Building Heat Load Contributions from Medium and Low Voltage Switchgear-Part I Solid Rectangular Bus Bar Heat Losses《中低压开关的建筑热负载作用 第I部分 固体矩形母线热损失》.pdf
  • ASHRAE LO-09-035-2009 Building Heat Load Contributions from Medium and Low Voltage Switchgear-Part II Component and Overall Switchgear Heat Gains《中低压开关的建筑热负载作用 第II部分 组件和总开关的热增量》.pdf ASHRAE LO-09-035-2009 Building Heat Load Contributions from Medium and Low Voltage Switchgear-Part II Component and Overall Switchgear Heat Gains《中低压开关的建筑热负载作用 第II部分 组件和总开关的热增量》.pdf
  • ASHRAE LO-09-036-2009 Performance Evaluation of Ceiling Mounted Personalized Ventilation System《天花板个性化通风系统安装的性能评估》.pdf ASHRAE LO-09-036-2009 Performance Evaluation of Ceiling Mounted Personalized Ventilation System《天花板个性化通风系统安装的性能评估》.pdf
  • ASHRAE LO-09-037-2009 Modeling of the Human Body to Study the Personal Micro Environment《私人微环境研究的人体建模》.pdf ASHRAE LO-09-037-2009 Modeling of the Human Body to Study the Personal Micro Environment《私人微环境研究的人体建模》.pdf
  • 相关搜索

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

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