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

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

1、三级信息管理技术机试-44 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.已知数据文件 IN10.DAT中存有 300个四位数,并已调用读函数 readDat()把这些数存入数组 a中,请编制一个函数 jsValue(),其功能是:求出千位数上的数减百位数上的数减十位数上的数减个位数上的数大于零的个数 cnt,再把所有满足此条件的四位数依次存入数组 b中,然后对数组 b中的四位数按从小到大的顺序进行排序,最后调用写函数 writeDat()把数组 b中的数输出到 OUT10.DAT文件。例如:9123,9-1-2-30,则该数满足条件存入

2、数组 b,且个数 cnt=cnt+1。9812,9-8-1-20,则该数不满足条件,忽略。注意:部分源程序已给出。程序中已定义数组:a300,b300;已定义变量:cnt。请勿改动主函数main()、读函数 readDat()和写函数 writeDat()的内容。试题程序#includestdio.hint a300,b300,cnt=0;jsValue()main()int i;readDat();jsValue();writeDat();for(i=0;icnt;i+)prmtf(“b%d=%dn“,i,bi);readDat()FILE *fp;int i;fp=fopen(“IN10.

3、DAT“,“r“);for(i=0;i300;i+)fscanf(fP,“%d,“,i+)fprintf(fp,“%dn“,bi);fclose(fp);(分数:100.00)_三级信息管理技术机试-44 答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.已知数据文件 IN10.DAT中存有 300个四位数,并已调用读函数 readDat()把这些数存入数组 a中,请编制一个函数 jsValue(),其功能是:求出千位数上的数减百位数上的数减十位数上的数减个位数上的数大于零的个数 cnt,再把所有满足此条件的四位数依次存入数组 b中,然后对数组

4、 b中的四位数按从小到大的顺序进行排序,最后调用写函数 writeDat()把数组 b中的数输出到 OUT10.DAT文件。例如:9123,9-1-2-30,则该数满足条件存入数组 b,且个数 cnt=cnt+1。9812,9-8-1-20,则该数不满足条件,忽略。注意:部分源程序已给出。程序中已定义数组:a300,b300;已定义变量:cnt。请勿改动主函数main()、读函数 readDat()和写函数 writeDat()的内容。试题程序#includestdio.hint a300,b300,cnt=0;jsValue()main()int i;readDat();jsValue();

5、writeDat();for(i=0;icnt;i+)prmtf(“b%d=%dn“,i,bi);readDat()FILE *fp;int i;fp=fopen(“IN10.DAT“,“r“);for(i=0;i300;i+)fscanf(fP,“%d,“,i+)fprintf(fp,“%dn“,bi);fclose(fp);(分数:100.00)_正确答案:(jsValue()int i,thou,hun,ten,data,j;for(i=0;i300;i+)thou=ai/1000; /*取得四位数的千位数字*/hun=ai%1000/100; /*取得四位数的百位数字*/ten=ai%

6、100/10; /*取得四位数的十位数字*/data=ai%10; /*取得四位数的个位数字*/if(thou-hun-ten-data0)bcnt=ai;;cnt+;for(i=0;icnt-1;i+) /*将数组 b中的四位数按从小到大的顺序进行排序*/for(j=i+1;jcnt;j+)if(bibj)data=bi;bi=bj;bj=data;)解析:解析 此题型考查的知识点包括以下几方面:(1) 运算符“/”(相除)和“%”(取余)的灵活运用;(2) 循环结构的使用;(3) 数据的排序(在这里主要是使用选择排序法);(4) 选择结构的使用。根据题目要求:先顺序查找数组 a中的每个元素,并通过语句“thou=ai/1000;hun=ai%1000/100;ten=ai% 100/10;data=ai%10;”分别获取该四位数的千位、百位、十位和个位数字;然后进行条件判断,把满足条件为:将满足“千位数-百位数-十位数-个位数0”的四位数存入数组 b中,并用变量 cnt来记录满足条件的数值的个数;查找完数组 a中的所有元素后,运用选择排序法将数组 b中的元素进行升序排列。

展开阅读全文
相关资源
猜你喜欢
  • NBN-EN 136-1991 1250 Respiratory protective devices - Full-face masks - Requirements testing marking《呼吸防护装置 全遮面罩 要求;试验;标示》.pdf NBN-EN 136-1991 1250 Respiratory protective devices - Full-face masks - Requirements testing marking《呼吸防护装置 全遮面罩 要求;试验;标示》.pdf
  • NBN-EN 137-1989 5625 Respiratory protective devices Self-contained open-circuit compressed air breathing appartus - Requirements - testing - marking 《呼吸防护装置 带压缩空气的自持式闭路呼吸装置 要求;试验;标.pdf NBN-EN 137-1989 5625 Respiratory protective devices Self-contained open-circuit compressed air breathing appartus - Requirements - testing - marking 《呼吸防护装置 带压缩空气的自持式闭路呼吸装置 要求;试验;标.pdf
  • NBN-EN 137-1993 4375 Respiratory protective devices Self-contained open-circuit compressed air breathing apparatus Requirements testing marking《呼吸防护装置 压缩空气容器装置(压缩空气呼气器) 要求;试验;标记》.pdf NBN-EN 137-1993 4375 Respiratory protective devices Self-contained open-circuit compressed air breathing apparatus Requirements testing marking《呼吸防护装置 压缩空气容器装置(压缩空气呼气器) 要求;试验;标记》.pdf
  • NBN-EN 138-1994 1875 Respiratory protective devices - Fresh air hose breathing apparatus for use with full face mask half mask or mouthpiece assembly - Requirements testing marking.pdf NBN-EN 138-1994 1875 Respiratory protective devices - Fresh air hose breathing apparatus for use with full face mask half mask or mouthpiece assembly - Requirements testing marking.pdf
  • NBN-EN 139-1995 1250 Respiratory protective devices - Compressed air line breathing apparatus for use with a full face mask half mask or a mouthpiece assembly - Requirements testin.pdf NBN-EN 139-1995 1250 Respiratory protective devices - Compressed air line breathing apparatus for use with a full face mask half mask or a mouthpiece assembly - Requirements testin.pdf
  • NBN-EN 140 A1-1992 8750 Respiratory protective devices- Half masks and quarter masks- Requirements testing marking (Amendment 1 1992)《呼吸防护装置 半遮面罩和四分之一面罩要求,试验,标记(补充件 1:1992)》.pdf NBN-EN 140 A1-1992 8750 Respiratory protective devices- Half masks and quarter masks- Requirements testing marking (Amendment 1 1992)《呼吸防护装置 半遮面罩和四分之一面罩要求,试验,标记(补充件 1:1992)》.pdf
  • NBN-EN 140-1991 7500 Respiratory protective devices - Half-masks and quarter-masks - Requirements testing marking《呼吸防护装置 半遮面罩和四分之一面罩 要求;试验;标记》.pdf NBN-EN 140-1991 7500 Respiratory protective devices - Half-masks and quarter-masks - Requirements testing marking《呼吸防护装置 半遮面罩和四分之一面罩 要求;试验;标记》.pdf
  • NBN-EN 141-1991 1875 Respiratory protective devices - Gas filters and combined filters - Requirements testing marking《呼吸防护装置 毒气过滤器和组合过滤器 要求;试验;标记》.pdf NBN-EN 141-1991 1875 Respiratory protective devices - Gas filters and combined filters - Requirements testing marking《呼吸防护装置 毒气过滤器和组合过滤器 要求;试验;标记》.pdf
  • NBN-EN 142-1991 0000 Respiratory protective devices - Mouthpiece assemblies - Requirements testing marking《呼吸防护装置 口罩组件 要求;试验;标记》.pdf NBN-EN 142-1991 0000 Respiratory protective devices - Mouthpiece assemblies - Requirements testing marking《呼吸防护装置 口罩组件 要求;试验;标记》.pdf
  • 相关搜索

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

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