【计算机类职业资格】三级网络技术机试-115及答案解析.doc

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

1、三级网络技术机试-115 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.下列程序的功能是:选出 5000以下符合条件的自然数。条件是:千位数字与百位数字之和等于十位数字与个位数字之和,且千位数字与百位数字之和等于个位数字与千位数字之差的 10倍。计算并输出这些4位自然数的个数 cnt及这些数的和 sum。请编写函数 countValue()实现程序的要求,最后调用函数wfiteDAT()把结果 cnt和 sum输出到文件 OUT67.DAT中。注意:部分源程序已给出。请勿改动主函数 main()和写函数 writDAT()的内容。试题程序

2、includestdio.hint cnt,sum;void countValue()void main()cnt=sum=0;countValue ();printf (“满足条件的自然数的个数=%d/n“, cnt);printf (“满足条件的自然的值的和=%d/n“, sum);writeDAT ();writeDAT ( )FILE *fp;fp=fopen ( “OUT67. DAT“ , “w“ );fprintf (fp, “%d/n%d/n“, cnt, sum);fclose fp);(分数:100.00)_三级网络技术机试-115 答案解析(总分:100.00,做题时

3、间:90 分钟)一、上机题(总题数:1,分数:100.00)1.下列程序的功能是:选出 5000以下符合条件的自然数。条件是:千位数字与百位数字之和等于十位数字与个位数字之和,且千位数字与百位数字之和等于个位数字与千位数字之差的 10倍。计算并输出这些4位自然数的个数 cnt及这些数的和 sum。请编写函数 countValue()实现程序的要求,最后调用函数wfiteDAT()把结果 cnt和 sum输出到文件 OUT67.DAT中。注意:部分源程序已给出。请勿改动主函数 main()和写函数 writDAT()的内容。试题程序:#includestdio.hint cnt,sum;void

4、 countValue()void main()cnt=sum=0;countValue ();printf (“满足条件的自然数的个数=%d/n“, cnt);printf (“满足条件的自然的值的和=%d/n“, sum);writeDAT ();writeDAT ( )FILE *fp;fp=fopen ( “OUT67. DAT“ , “w“ );fprintf (fp, “%d/n%d/n“, cnt, sum);fclose fp);(分数:100.00)_正确答案:(void countValue()int i, thou, hun, ten, data;for (i=5000;

5、 i=1000; i-)t hou=i/1000; /*求四位数的千位数字*/hun=i%1000/100; /*求四位数的百位数字*/ten=i%100/10; /*求四位数的十位数字*/dat a=i%l 0; /*求四位数的个位数字*/if (thou+hun=ten+data /*则统计满足条件的数的个数*/sum+=i; /*将满足条件的数求和*/)解析:解析本题考查的知识点如下:(1) “%”与“/”的使用。(2)判断结构中多个条件的布尔运算。(3)循环结构的使用。本题要求选出 5000以下符合条件的 4位数,所以选择范围是 1000到 5000。这里要借助运算符“%”与“/”将 4位数各位上的数拆成独立的数字:将 1个 4位数整除 1000则可得到其千位上的数字,除以1000取余再整除 100 则可得百位上的数字,除以 100取余再整除 10则可得十位上的数字,除以 10取余则得个位卜的数字。题巾给出的两个条件都要满足,所以两条件之间用“与”运算。使用循环结构对1000到 5000之间的数依次进行上述的处理。

展开阅读全文
相关资源
猜你喜欢
  • DIN EN 15732-2013 Light weight fill and thermal insulation products for civil engineering applications (CEA) - Expanded clay lightweight aggregate products (LWA) German version EN .pdf DIN EN 15732-2013 Light weight fill and thermal insulation products for civil engineering applications (CEA) - Expanded clay lightweight aggregate products (LWA) German version EN .pdf
  • DIN EN 15733-2011 Services of real estate agents - Requirements for the provision of services of real estate agents German version EN 15733 2009《房地产经纪人服务 房地产经纪人服务的提供要求 德文版本EN 15733.pdf DIN EN 15733-2011 Services of real estate agents - Requirements for the provision of services of real estate agents German version EN 15733 2009《房地产经纪人服务 房地产经纪人服务的提供要求 德文版本EN 15733.pdf
  • DIN EN 15734-1-2013 Railway applications - Braking systems of high speed trains - Part 1 Requirements and definitions German version EN 15734-1 2010 + AC 2013《轨道交通 高速火车的制动系统 第1部分 要.pdf DIN EN 15734-1-2013 Railway applications - Braking systems of high speed trains - Part 1 Requirements and definitions German version EN 15734-1 2010 + AC 2013《轨道交通 高速火车的制动系统 第1部分 要.pdf
  • DIN EN 15734-2-2013 Railway applications-Braking systems of high speed trains-Part2 Test methods English version EN 15734-2 2010+AC 2012 English translation of DIN EN 15734-2 2013-.pdf DIN EN 15734-2-2013 Railway applications-Braking systems of high speed trains-Part2 Test methods English version EN 15734-2 2010+AC 2012 English translation of DIN EN 15734-2 2013-.pdf
  • DIN EN 15736-2009 Timber structures - Test methods - Withdrawal capacity of punched metal plate fasteners in handling and erection of prefabricated trusses German version EN 15736 .pdf DIN EN 15736-2009 Timber structures - Test methods - Withdrawal capacity of punched metal plate fasteners in handling and erection of prefabricated trusses German version EN 15736 .pdf
  • DIN EN 15737-2009 Timber structures - Test methods - Torsional resistance of driving in screws German version EN 15737 2009《木材结构 测试方法 螺钉推进时的扭转阻力 德文版本 EN 15737 2009》.pdf DIN EN 15737-2009 Timber structures - Test methods - Torsional resistance of driving in screws German version EN 15737 2009《木材结构 测试方法 螺钉推进时的扭转阻力 德文版本 EN 15737 2009》.pdf
  • DIN EN 15741-2009 Animal feeding stuffs - Determination of OC-pesticides and PCB-s by GC MS German version EN 15741 2009《动物饲料填料 利用GC MS对多氯化联(二)苯(PCB-s)和OC杀虫剂的测定 德文版本EN 15741-2009》.pdf DIN EN 15741-2009 Animal feeding stuffs - Determination of OC-pesticides and PCB-s by GC MS German version EN 15741 2009《动物饲料填料 利用GC MS对多氯化联(二)苯(PCB-s)和OC杀虫剂的测定 德文版本EN 15741-2009》.pdf
  • DIN EN 15742-2009 Animal feeding stuffs - Determination of OC-pesticides and PCB-s by GC ECD English version of DIN EN 15742 2009-06《牲畜饲料 用GC ECD对OC杀虫剂和PCB的测定》.pdf DIN EN 15742-2009 Animal feeding stuffs - Determination of OC-pesticides and PCB-s by GC ECD English version of DIN EN 15742 2009-06《牲畜饲料 用GC ECD对OC杀虫剂和PCB的测定》.pdf
  • DIN EN 15743-2015 Supersulfated cement - Composition specifications and conformity criteria German version EN 15743 2010+A1 2015《富硫酸盐水泥 组分、规范和一致性标准 德文版本EN 15743-2010+A1-2015》.pdf DIN EN 15743-2015 Supersulfated cement - Composition specifications and conformity criteria German version EN 15743 2010+A1 2015《富硫酸盐水泥 组分、规范和一致性标准 德文版本EN 15743-2010+A1-2015》.pdf
  • 相关搜索

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

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