[计算机类试卷]国家三级信息管理技术机试模拟试卷30及答案与解析.doc

上传人:tireattitude366 文档编号:494956 上传时间:2018-11-28 格式:DOC 页数:3 大小:28KB
下载 相关 举报
[计算机类试卷]国家三级信息管理技术机试模拟试卷30及答案与解析.doc_第1页
第1页 / 共3页
[计算机类试卷]国家三级信息管理技术机试模拟试卷30及答案与解析.doc_第2页
第2页 / 共3页
[计算机类试卷]国家三级信息管理技术机试模拟试卷30及答案与解析.doc_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
资源描述

1、国家三级信息管理技术机试模拟试卷 30及答案与解析 一、程序设计题 1 在文件 IN30.DAT中有 200组数据,每组有 3个数,每个数均是 3位数。函数readDat()是读取这 200组数据存放到结构数组 aa中。请编制函数 jsSort(),其函数的功能是:要求在 200组数据中找出条件为每组数据中的第二个数大于第一个数加第三个数之和,其中满足条件的个数作为函数 jsSort()的返回值,同时把满足条件的数据存入结构数组 bb中,再对结构数组 bb中的数据按照每组数据的第二个数加第三个数之和的大小进行降序排列,排序后 的结果仍重新存入结构数组 bb中,最后调用函数 writeDat()

2、把结果 bb输出到文件 OUT30.DAT中。 注意:部分源程序已给出。 请勿改动主函数 main()、读函数 readDat()和写函数 writeDat()的内容。 试题程序: #include stdio.h #include string.h #include conio.h typedef struct int x1, x2, x3; Data; Data aa200, bb200; int jsSort () main ( ) int count; readDat ( ); count = jsSort(); /*返回满足条件的个数 */ writeDat (count); rea

3、dDat ( ) FILE *in; int i; in = fopen(“IN30.DAT“, “r“); for(i=0; i 200; i+) fscanf(in, “%d %d %d“, fclose (in); writeDat(int count) FILE *out; int i; out= fopen(“OUT30.DAT“, “w“); clrscr ( ); for(i=0; i count; i+) printf(“%d, %d, %d 第二个数第三个数 %dn“, bbi.x1, bbi.x2, bbi.x3, bbi .x2+bbi . x3); fprintf(ou

4、t, “%d, %5d, %dn“, bbi.x1, bbi.x2, bbi.x3); fclose (out); 国家三级信息管理技术机试模拟试卷 30答案与解析 一、程序设计题 1 【正确答案】 int jsSort () int i, cnt=0, j; Data ch; for (i=0; i 200 ;i+) if(aai.x2aai.x1+aai.x3) /*如果第二个数大于第一个数加第三个数之和 */ bb cnt =aa i; /*则把该组数据存入结构数组 bb中 */ cnt+; /*统计满足条件的数据的组数 */ for (i=0; i cnt-1; i+) /*对结构数组

5、 bb中的数据按照每组 数据的第二个数 */ for (j=i+1; j cnt; j+) /*加第三个数之和的大小进行降序排列 */ if(bbi.x2+bbi.x3 bbj.x2+bbj.x3) ch=bb i; bbi =bbj ; bb j =ch; return cnt; /*返回满足条件的个数 */ 【试题解析】 本题考查对结构体数组中的元素的各个域的操作。首先利用一个for循环来依次取得结构体数组中的各个元素,之后按照题目要求对当前的元素的各个域进行条件判断,由语句 “if (aai.x2aai.x1+aai.x3)”来实现。如果该条件成立,则把被判断元素存放到数组比中去,当符合条件的所有元素被找完后,按照 “每组数据中的第二个数加第三个数之和的大小 ”进行从大到小的排序。解答本题的关键是要弄清被处理对象是结构体变量中的某个域,而不是 结构体变量本身。

展开阅读全文
相关资源
猜你喜欢
  • BS ISO 6117-2005 en_8336  Road vehicles - Elastomeric boots for drum-type hydraulic brake wheel cylinders using a non-petroleum base hydraulic brake fluid (service temperature 100 C max.)《道.pdf BS ISO 6117-2005 en_8336 Road vehicles - Elastomeric boots for drum-type hydraulic brake wheel cylinders using a non-petroleum base hydraulic brake fluid (service temperature 100 C max.)《道.pdf
  • BS ISO 614-2012 en_8589  Ships and marine technology Toughened safety glass panes for rectangular windows and side scuttles Punch method of non-destructive strength testing《船舶和海洋技术 舷.pdf BS ISO 614-2012 en_8589 Ships and marine technology Toughened safety glass panes for rectangular windows and side scuttles Punch method of non-destructive strength testing《船舶和海洋技术 舷.pdf
  • BS ISO 6162-1-2012 en_5574  Hydraulic fluid power Flange connections with split or one-piece flange clamps and metric or inch screws Flange connectors ports and mounting surfaces .pdf BS ISO 6162-1-2012 en_5574 Hydraulic fluid power Flange connections with split or one-piece flange clamps and metric or inch screws Flange connectors ports and mounting surfaces .pdf
  • BS ISO 6358-1-2013 en_9874  Pneumatic fluid power Determination of flow-rate characteristics of components using compressible fluids General rules and test methods for steady-state flow《气压.pdf BS ISO 6358-1-2013 en_9874 Pneumatic fluid power Determination of flow-rate characteristics of components using compressible fluids General rules and test methods for steady-state flow《气压.pdf
  • BS ISO 6362-6-2012 en_2338  Wrought aluminium and aluminium alloys Extruded rods bars tubes and profiles Round square rectangular and hexagonal tubes Tolerances on shape and dimensions《锻造铝和.pdf BS ISO 6362-6-2012 en_2338 Wrought aluminium and aluminium alloys Extruded rods bars tubes and profiles Round square rectangular and hexagonal tubes Tolerances on shape and dimensions《锻造铝和.pdf
  • BS ISO 639-4-2010 en_1543  Codes for the representation of names of languages - General principles of coding of the representation of names of languages and related entities and application guidel.pdf BS ISO 639-4-2010 en_1543 Codes for the representation of names of languages - General principles of coding of the representation of names of languages and related entities and application guidel.pdf
  • BS ISO 6432-2015 en_3486  Pneumatic fluid power Single rod cylinders 1 000 kPa (10 bar) series bores from 8 mm to 25 mm Basic and mounting dimensions《气动流体动力.单杆汽缸.1100kPa(10bar)系列..pdf BS ISO 6432-2015 en_3486 Pneumatic fluid power Single rod cylinders 1 000 kPa (10 bar) series bores from 8 mm to 25 mm Basic and mounting dimensions《气动流体动力.单杆汽缸.1100kPa(10bar)系列..pdf
  • BS ISO 6953-2-2015 en_6113  Pneumatic fluid power Compressed air pressure regulators and filter-regulators Test methods to determine the main characteristics to be included in literature from supp.pdf BS ISO 6953-2-2015 en_6113 Pneumatic fluid power Compressed air pressure regulators and filter-regulators Test methods to determine the main characteristics to be included in literature from supp.pdf
  • BS ISO 6953-3-2013 en_2478  Pneumatic fluid power Compressed air pressure regulators and filter-regulators Alternative test methods for measuring the flow-rate characteristics of pressure regulat.pdf BS ISO 6953-3-2013 en_2478 Pneumatic fluid power Compressed air pressure regulators and filter-regulators Alternative test methods for measuring the flow-rate characteristics of pressure regulat.pdf
  • 相关搜索

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

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