【计算机类职业资格】三级信息管理技术机试-93及答案解析.doc

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

1、三级信息管理技术机试-93 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.已知数据文件 IN69.DAT 中存有 200 个 4 位数,并已调用读函数 readDat()把这些数存入数组 a 中,请编制一函数 jsVal(),其功能是:把一个 4 位数的千位数上的值减百位数上的值再减十位数上的值最后减个位数上的值,如果得出的值大于等于零且此 4 位数是奇数,则统计出满足此条件的数的个数 cnt 并把这些 4 位数存入数组 b 中,然后对数组 b 的 4 位数按从小到大的顺序进行排序,最后调用函数 writeDat()把结果 cnt 及数组

2、 b 中的符合条件的 4 位数输出到 out69.dat 文件中。注意:部分源程序已给出。程序中已定义数组:a200,b200,己定义变量:cnt。请勿改动主函数 main()、读函数 readDat()和写函数 writeDat()的内容。试题程序:# inc ludestdio, h#define MAX 200int a MAX, b MAX, cnt=0;void jsVal()void readDat ( )int i;FILE *fp;fp= fopen ( “IN69. DAT“, “r“ );for (i=0; iMAX; i+)fscanf (fp, “%d“ ,fclose

3、 (fp);void main ( )int i;readDat ( );jsVal ( );printf (“满足条件的数=%d/n“, cnt );for (i=0; icnt; i+)printf(“%d“,bi);printf ( “/n“ );writeDat ();writeDat ( )FILE *fp;int i;fp=fopen ( “out69. dat“, “w“ );fprintf (fp, “%din“, cnt);for (i=0; icnt; i+)fprint f ( fp, “%din“, b i );fclose(fp);(分数:100.00)_三级信息管理

4、技术机试-93 答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.已知数据文件 IN69.DAT 中存有 200 个 4 位数,并已调用读函数 readDat()把这些数存入数组 a 中,请编制一函数 jsVal(),其功能是:把一个 4 位数的千位数上的值减百位数上的值再减十位数上的值最后减个位数上的值,如果得出的值大于等于零且此 4 位数是奇数,则统计出满足此条件的数的个数 cnt 并把这些 4 位数存入数组 b 中,然后对数组 b 的 4 位数按从小到大的顺序进行排序,最后调用函数 writeDat()把结果 cnt 及数组 b 中的符合

5、条件的 4 位数输出到 out69.dat 文件中。注意:部分源程序已给出。程序中已定义数组:a200,b200,己定义变量:cnt。请勿改动主函数 main()、读函数 readDat()和写函数 writeDat()的内容。试题程序:# inc ludestdio, h#define MAX 200int a MAX, b MAX, cnt=0;void jsVal()void readDat ( )int i;FILE *fp;fp= fopen ( “IN69. DAT“, “r“ );for (i=0; iMAX; i+)fscanf (fp, “%d“ ,fclose (fp);v

6、oid main ( )int i;readDat ( );jsVal ( );printf (“满足条件的数=%d/n“, cnt );for (i=0; icnt; i+)printf(“%d“,bi);printf ( “/n“ );writeDat ();writeDat ( )FILE *fp;int i;fp=fopen ( “out69. dat“, “w“ );fprintf (fp, “%din“, cnt);for (i=0; icnt; i+)fprint f ( fp, “%din“, b i );fclose(fp);(分数:100.00)_正确答案:(void js

7、Val()int i, thou, hun, ten, data, j;for (i=0; iMAX; i+)thou=a i/1000; /*求四位数的千位数字*/hun=a i %1000/100; /*求四数数的百位数字*/ten=a i %100/10; /*求四位数的十位数字*/data=ai%10; /*求四位数的个位数字*/if( (thou-hun-ten-data 0) /*则将该数存入数组 b 中*/ont +; /*统计满足条件的数的个数*/for (i=0; i ont-1; i + ) /*对数组 b 的 4 位数按从小到大的顺序进行排序*/for (j=i+l; j

8、cnt; j+)if (bi bj )data=b i;bi=bj;bi=data;)解析:解析 本题考查的知识点如下:(1) “%”与“/”的使用。(2)循环结构与判断结构的使用。(3)数据的排序。本题中,首先借助“%”与“/”将 4 位数各位上的数拆成独立的数字:将 1 个 4 位数整除 1000 则可得到其千位上的数字,除以 1000 取余再整除 100 则可得百位上的数字,除以 100 取余再整除 10 则可得十位上的数字,除以 10 取余则得个位上的数字。1 个数除以 2 取余所得的数等于 1,则此数是奇数。利用循环结构实现对 200 个数据的判断。题中要求将符合条件的 4 位数按从小到大的顺序存入数组 b 中,我们可以先将符合条件的 4 位数存入数组 b,然后对 b 中的数进行排序。排序使用“选择排序法”。

展开阅读全文
相关资源
猜你喜欢
  • DIN EN 326-2-2014 Wood-based panels - Sampling cutting and inspection - Part 2 Initial type testing and factory production control German version EN 326-2 2010+A1 2014《木质板 取样 切割和检验.pdf DIN EN 326-2-2014 Wood-based panels - Sampling cutting and inspection - Part 2 Initial type testing and factory production control German version EN 326-2 2010+A1 2014《木质板 取样 切割和检验.pdf
  • DIN EN 326-3-2004 Wood-based panels - Sampling cutting and inspection - Part 3 Inspection of an isolated lot of panels German version EN 326-3 2003《木基板材 取样、切割和检验 第3部分 单批板材的检验》.pdf DIN EN 326-3-2004 Wood-based panels - Sampling cutting and inspection - Part 3 Inspection of an isolated lot of panels German version EN 326-3 2003《木基板材 取样、切割和检验 第3部分 单批板材的检验》.pdf
  • DIN EN 3266-2002 Aerospace series - Pipe coupling in titanium alloy - Bulkhead nut German version EN 3266 2001《航空航天系列 钛合金管连接件 闷头螺母 德文版本 EN 3266 2001》.pdf DIN EN 3266-2002 Aerospace series - Pipe coupling in titanium alloy - Bulkhead nut German version EN 3266 2001《航空航天系列 钛合金管连接件 闷头螺母 德文版本 EN 3266 2001》.pdf
  • DIN EN 3267-2002 Aerospace series - Washers bulkhead in titanium alloy German version EN 3267 2001《航空航天系列 钛合金闷头垫圈 德文版本 EN 3267 2001》.pdf DIN EN 3267-2002 Aerospace series - Washers bulkhead in titanium alloy German version EN 3267 2001《航空航天系列 钛合金闷头垫圈 德文版本 EN 3267 2001》.pdf
  • DIN EN 3268-2015 Aerospace series - Pipe coupling 830′ in titanium alloy - Pressure plugs German and English version EN 3268 2014《航空航天系列 钛合金830-管连接件 压力插头 德文版本 EN 3268-2014》.pdf DIN EN 3268-2015 Aerospace series - Pipe coupling 830′ in titanium alloy - Pressure plugs German and English version EN 3268 2014《航空航天系列 钛合金830-管连接件 压力插头 德文版本 EN 3268-2014》.pdf
  • DIN EN 3269-2006 Aerospace series - Pipe coupling 830- in titanium alloy - Ferrules blind with dynamic beam seal end German and English version EN 3269 2001《航空航天系列 830-钛合金管接头 带动态梁密.pdf DIN EN 3269-2006 Aerospace series - Pipe coupling 830- in titanium alloy - Ferrules blind with dynamic beam seal end German and English version EN 3269 2001《航空航天系列 830-钛合金管接头 带动态梁密.pdf
  • DIN EN 327-2014 Heat exchangers - Forced convection air cooled refrigerant condensers - Test procedures for establishing performance German version EN 327 2014《热交换器 强制对流空气冷却制冷剂凝结器 .pdf DIN EN 327-2014 Heat exchangers - Forced convection air cooled refrigerant condensers - Test procedures for establishing performance German version EN 327 2014《热交换器 强制对流空气冷却制冷剂凝结器 .pdf
  • DIN EN 3270-2004 Aerospace series - Pipe coupling 830 in titanium alloy - Blanking plugs with lockring German and English version EN 3270 2001 + AC 2003《航空航天系列 830-钛合金管连接件 带锁紧环的堵塞》.pdf DIN EN 3270-2004 Aerospace series - Pipe coupling 830 in titanium alloy - Blanking plugs with lockring German and English version EN 3270 2001 + AC 2003《航空航天系列 830-钛合金管连接件 带锁紧环的堵塞》.pdf
  • DIN EN 3272-2006 Aerospace series - Pipe coupling 830- - Dynamic beam seal end for ferrule welded - Geometric configuration German and English version EN 3272 2001《航空航天系列 830-管接头 焊.pdf DIN EN 3272-2006 Aerospace series - Pipe coupling 830- - Dynamic beam seal end for ferrule welded - Geometric configuration German and English version EN 3272 2001《航空航天系列 830-管接头 焊.pdf
  • 相关搜索

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

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