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

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

1、三级信息管理技术机试-253 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.下列程序的功能是:计算出自然数 SIX 和 NINE,它们满足的条件是 SIX+SIX+SIX=NINE+NINE 的个数cnt,以及满足此条件的所有 SIX 与 NINE 的和 sum。请编写函数 countValue()实现程序要求,最后调用函数 writeDAT()把结果 cnt 和 sum 输出到文件 OUT82.DAT 中。其中的 S、I、X、N、E 各代表一个十进制数字。注意:部分源程序已给出。请勿改动主函数 main()和写函数 writeDAT()

2、的内容。试题程序:#include stdio.hint cnt,sum;void writeDAT();void countValue()void main()cnt=sum=0;countValue();printf(“满足条件的个数=% d/n“,cnt);printf(“满足条件所有的 SIX 与 NINE 的和=% d/n“,sum);writeDAT();void writeDAT()FILE * fp;fP=fopen(“OUT82.DAT“,“w“);fprintf(fp,“% d/n% d/n“,cnt,sum);fclose(fp);(分数:100.00)_三级信息管理技术

3、机试-253 答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.下列程序的功能是:计算出自然数 SIX 和 NINE,它们满足的条件是 SIX+SIX+SIX=NINE+NINE 的个数cnt,以及满足此条件的所有 SIX 与 NINE 的和 sum。请编写函数 countValue()实现程序要求,最后调用函数 writeDAT()把结果 cnt 和 sum 输出到文件 OUT82.DAT 中。其中的 S、I、X、N、E 各代表一个十进制数字。注意:部分源程序已给出。请勿改动主函数 main()和写函数 writeDAT()的内容。试题程序:

4、include stdio.hint cnt,sum;void writeDAT();void countValue()void main()cnt=sum=0;countValue();printf(“满足条件的个数=% d/n“,cnt);printf(“满足条件所有的 SIX 与 NINE 的和=% d/n“,sum);writeDAT();void writeDAT()FILE * fp;fP=fopen(“OUT82.DAT“,“w“);fprintf(fp,“% d/n% d/n“,cnt,sum);fclose(fp);(分数:100.00)_正确答案:(void countV

5、alue()int i,j; /*定义变量分别存储 SIX(i)和 NINE(j)*/int a2,b4,b3,b2; /*计算满足条件的数*/for(i=100,j=1000;i=999&j=9999;i=i+2) /*当 i 为 3 位偶数,并且 j 没有增加到 5 位数时,循环继续*/j=3*i/2; /*计算满足条件的 4 位数*/a2=i%100/10;b4=j/1000;b3=j%1000/100;b2=j%100/10;if(j=1000 & j=9999 & a2=b3 & b4=b2)/*如果满足条件 SIX+SIX+SIX=NINE+NINE*/ /*即一个 3 位数乘以

6、3 再除以 2 余数为 0,且所得的数为 4 位数*/cnt + +; /*统计满足条件的数的个数*/sum+=i+j; /*求满足此条件的所有 SIX 与 NINE 的和*/printf(“SIX=% d,NINE=% d/n“,i,j);)解析:解析 根据题意,要求的是满足 3 位数乘以 3 等于 4 位数乘以 2 的数的个数。我们可以使用循环结构对所有的 3 位数进行判断,若某个 3 位数乘以 3 整除以 2 所得的数是 4 位整数,且该 3 位数的十位数值等于该 4 位数的百位数值,该 4 位数的千位数值等于其十位数值,则这个 3 位数是满足条件的数。当判断的数不再是 3 位数或者处理后所得的数大于 9999,则退出循环。在循环内部用计数器统计满足条件的数的个数及它们的和值。

展开阅读全文
相关资源
猜你喜欢
  • AECMA PREN 2403-1998 Aerospace Series Heat Resisting Alloy NI-CH2601 (NiCr19Fe19Nb5Mo3) Vacuum Melted Solution Treated and Precipitation Treated Precision Casting a or D Less Than .pdf AECMA PREN 2403-1998 Aerospace Series Heat Resisting Alloy NI-CH2601 (NiCr19Fe19Nb5Mo3) Vacuum Melted Solution Treated and Precipitation Treated Precision Casting a or D Less Than .pdf
  • AECMA PREN 2404-1999 Heat Resisting Nickel Base Alloy NI-P100-HT Solution Treated and Precipitation Treated Bars Aerospace Series Edition 2 Supersedes Edition 1 May 1980 [Refer To .pdf AECMA PREN 2404-1999 Heat Resisting Nickel Base Alloy NI-P100-HT Solution Treated and Precipitation Treated Bars Aerospace Series Edition 2 Supersedes Edition 1 May 1980 [Refer To .pdf
  • AECMA PREN 2405-1998 Heat Resisting Nickel Base Alloy NI-P100-HT Solution Treated and Precipitation Treated Forgings Aerospace Series Edition 2 [Refer To ASD-STAN PREN 2405]《航空航天系列.pdf AECMA PREN 2405-1998 Heat Resisting Nickel Base Alloy NI-P100-HT Solution Treated and Precipitation Treated Forgings Aerospace Series Edition 2 [Refer To ASD-STAN PREN 2405]《航空航天系列.pdf
  • AECMA PREN 2406-1980 Heat Resisting Nickel Base Alloy NI-P101-HT Solution Treated and Precipitation Treated Bars for Forged Bolts D Less Than or Equal to 25 mm Aerospace Series Edi.pdf AECMA PREN 2406-1980 Heat Resisting Nickel Base Alloy NI-P101-HT Solution Treated and Precipitation Treated Bars for Forged Bolts D Less Than or Equal to 25 mm Aerospace Series Edi.pdf
  • AECMA PREN 2407-1998 Heat Resisting Nickel Base Alloy NI-P100-HT Solution Treated and Precipitation Treated Sheets and Strips a Less Than or Equal to 3 mm Aerospace Series Edition .pdf AECMA PREN 2407-1998 Heat Resisting Nickel Base Alloy NI-P100-HT Solution Treated and Precipitation Treated Sheets and Strips a Less Than or Equal to 3 mm Aerospace Series Edition .pdf
  • AECMA PREN 2408-1980 Heat Resisting Nickel Base Alloy NI-P100-HT Solution Treated and Precipitation Treated Plates a Greater Than 3 mm Aerospace Series Edition 1《航空航天系列.镍基合金 NI-P10.pdf AECMA PREN 2408-1980 Heat Resisting Nickel Base Alloy NI-P100-HT Solution Treated and Precipitation Treated Plates a Greater Than 3 mm Aerospace Series Edition 1《航空航天系列.镍基合金 NI-P10.pdf
  • AECMA PREN 2411-1980 Heat Resisting Nickel Base Alloy NI-P91-HT Annealed Plates a Greater Than 3 mm Aerospace Series Edition 1《航空航天系列.镍基合金 NI-P91-HT退火板材a 3 mm.第1版》.pdf AECMA PREN 2411-1980 Heat Resisting Nickel Base Alloy NI-P91-HT Annealed Plates a Greater Than 3 mm Aerospace Series Edition 1《航空航天系列.镍基合金 NI-P91-HT退火板材a 3 mm.第1版》.pdf
  • AECMA PREN 2413-1994 Aerospace Series Bolts Thin Hexagonal Head Close Tolerance Shank Short Thread in Alloy Steel Cadmium Plated Classification  1 100 MPa (at Ambient Temperature) .pdf AECMA PREN 2413-1994 Aerospace Series Bolts Thin Hexagonal Head Close Tolerance Shank Short Thread in Alloy Steel Cadmium Plated Classification 1 100 MPa (at Ambient Temperature) .pdf
  • AECMA PREN 2414-1993 Aerospace Series Washers Chamfered with Counterbore in Alloy Steel Cadmium Plated Edition P 1《 航空航天系列.镀镉合金钢镗孔倒角垫圈.P1版》.pdf AECMA PREN 2414-1993 Aerospace Series Washers Chamfered with Counterbore in Alloy Steel Cadmium Plated Edition P 1《 航空航天系列.镀镉合金钢镗孔倒角垫圈.P1版》.pdf
  • 相关搜索

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

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