【计算机类职业资格】三级信息管理技术机试-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,则退出循环。在循环内部用计数器统计满足条件的数的个数及它们的和值。

展开阅读全文
相关资源
猜你喜欢
  • GOST 17173-1981 Spectral slits and attachments to them Types basic parameters and dimensions Technical requirements《光谱仪缝隙及其配件 基本参数和尺寸 技术要求》.pdf GOST 17173-1981 Spectral slits and attachments to them Types basic parameters and dimensions Technical requirements《光谱仪缝隙及其配件 基本参数和尺寸 技术要求》.pdf
  • GOST 17175-1982 Lenses for photography motion picture television Series of numerical values of relative apertures《摄影 电影和电视用透镜 相对孔径数值》.pdf GOST 17175-1982 Lenses for photography motion picture television Series of numerical values of relative apertures《摄影 电影和电视用透镜 相对孔径数值》.pdf
  • GOST 17177-1994 Thermal insulating materials and products for building application Test methods《绝热的建筑材料与制品 试验方法》.pdf GOST 17177-1994 Thermal insulating materials and products for building application Test methods《绝热的建筑材料与制品 试验方法》.pdf
  • GOST 17178-1971 Turret lathe adapters with rib and Morse cone hole Design and dimensions《带肋材和莫尔斯锥孔六角车床适配器 设计和尺寸规格》.pdf GOST 17178-1971 Turret lathe adapters with rib and Morse cone hole Design and dimensions《带肋材和莫尔斯锥孔六角车床适配器 设计和尺寸规格》.pdf
  • GOST 17179-1971 Turret lathe with cylindrical collets Design and dimensions《六角车床用圆柱形夹紧套 结构及尺寸》.pdf GOST 17179-1971 Turret lathe with cylindrical collets Design and dimensions《六角车床用圆柱形夹紧套 结构及尺寸》.pdf
  • GOST 17180-1971 Turret lathe collets with eccentrically positioned cylindrical hole Design and dimensions《六角车床用带偏心圆柱孔夹紧套 结构及尺寸》.pdf GOST 17180-1971 Turret lathe collets with eccentrically positioned cylindrical hole Design and dimensions《六角车床用带偏心圆柱孔夹紧套 结构及尺寸》.pdf
  • GOST 17181-1971 Turret lathe collets with inclined cylindrical hole Design and dimensions《带倾斜圆柱孔的六角车床夹簧 设计和尺寸规格》.pdf GOST 17181-1971 Turret lathe collets with inclined cylindrical hole Design and dimensions《带倾斜圆柱孔的六角车床夹簧 设计和尺寸规格》.pdf
  • GOST 17182-1971 Turret lathe collets with eccentrically positioned hole for double nests Design and dimensions《六角车床用双插座用带偏心圆柱孔夹紧套 结构及尺寸》.pdf GOST 17182-1971 Turret lathe collets with eccentrically positioned hole for double nests Design and dimensions《六角车床用双插座用带偏心圆柱孔夹紧套 结构及尺寸》.pdf
  • GOST 17183-1971 Turret lathe collets with displaced cylindrical hole for double nests Design and dimensions《六角车床双插座用带错位圆柱孔夹紧套 结构及尺寸》.pdf GOST 17183-1971 Turret lathe collets with displaced cylindrical hole for double nests Design and dimensions《六角车床双插座用带错位圆柱孔夹紧套 结构及尺寸》.pdf
  • 相关搜索

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

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