【计算机类职业资格】计算机三级(信息管理技术)上机考试25及答案解析.doc

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

1、计算机三级(信息管理技术)上机考试 25及答案解析(总分:-1.00,做题时间:90 分钟)1.请编写函数 countValue(),它的功能是:求 n以内(不包括 n)同时能被 3与 7整除的所有自然数之和的平方根 s,并作为函数值返回,最后结果 s输出到文件 OUT11.DAT中。 例如,若 n为 1000时,函数值应为 s=153.909064。 注意:部分源程序已给出。 请勿改动主函数 main()和输入输出函数progReadWrite()的内容。 试题程序: #include #include #include double countValue(int n) main() clr

2、scr(); printf(“自然数之和的平方根=%fn“, countValue(1000); progReadWrite(); progReadWrite() FILE *wf; int i, n; float s; wf = fopen(“OUT11.DAT“, “w“); s = countValue(1000); fprintf(wf, “%fn“, s); fclose(wf); (分数:-1.00)_计算机三级(信息管理技术)上机考试 25答案解析(总分:-1.00,做题时间:90 分钟)1.请编写函数 countValue(),它的功能是:求 n以内(不包括 n)同时能被 3与

3、 7整除的所有自然数之和的平方根 s,并作为函数值返回,最后结果 s输出到文件 OUT11.DAT中。 例如,若 n为 1000时,函数值应为 s=153.909064。 注意:部分源程序已给出。 请勿改动主函数 main()和输入输出函数progReadWrite()的内容。 试题程序: #include #include #include double countValue(int n) main() clrscr(); printf(“自然数之和的平方根=%fn“, countValue(1000); progReadWrite(); progReadWrite() FILE *wf;

4、int i, n; float s; wf = fopen(“OUT11.DAT“, “w“); s = countValue(1000); fprintf(wf, “%fn“, s); fclose(wf); (分数:-1.00)_正确答案:(double countValue(int n) double xy=0.0; int i; for(i=1;i解析:本题的解题思路是:利用一个 for循环依次从 n个自然数当中取数,对当前取出的数进行条件判断。判断条件为:既能被 3整除同时也能被 7整除,因此,用“&”运算符来连接两个条件表达式,当某数满足判断条件时,就把该数累加到变量 xy中(xy 的初始值为 0.0),当所有满足条件的数都被找完后,对累加求得的变量 xy的值进行求平方根的计算,并把所求得的结果作为函数值返回。

展开阅读全文
相关资源
猜你喜欢
  • DS EN 30326-1-1994 Mechanical vibration-Laboratory method for evaluating vehicle seat vibration-Part 1 Basic requirements《机械振动 车辆座椅振动的试验室评估法 第1部分:基本要求》.pdf DS EN 30326-1-1994 Mechanical vibration-Laboratory method for evaluating vehicle seat vibration-Part 1 Basic requirements《机械振动 车辆座椅振动的试验室评估法 第1部分:基本要求》.pdf
  • DS EN 304-1993 Heating boilers Test code for heating boilers for atomizing oil burners《采暖锅炉 采暖锅炉雾化油燃烧器的试验规则》.pdf DS EN 304-1993 Heating boilers Test code for heating boilers for atomizing oil burners《采暖锅炉 采暖锅炉雾化油燃烧器的试验规则》.pdf
  • DS EN 3045-1994 Aerospace series Bearings airframe rolling Rigid single row ball bearings in steel Diameter series 0 and 2 Reduced clearance category Dimensions and loads《航空航天系列 机身.pdf DS EN 3045-1994 Aerospace series Bearings airframe rolling Rigid single row ball bearings in steel Diameter series 0 and 2 Reduced clearance category Dimensions and loads《航空航天系列 机身.pdf
  • DS EN 3046-1994 Aerospace series Bearings airframe rolling Rigid single row ball bearings in steel cadmium plated Diameter series 0 and 2 Reduced clearance category Dimensions and .pdf DS EN 3046-1994 Aerospace series Bearings airframe rolling Rigid single row ball bearings in steel cadmium plated Diameter series 0 and 2 Reduced clearance category Dimensions and .pdf
  • DS EN 3047-1994 Aerospace series Bearings airframe rolling Rigid single row ball bearings in corrosion resisting steel Diameter series 0 and 2 Reduced clearance category Dimensions.pdf DS EN 3047-1994 Aerospace series Bearings airframe rolling Rigid single row ball bearings in corrosion resisting steel Diameter series 0 and 2 Reduced clearance category Dimensions.pdf
  • DS EN 3053-1994 Aerospace series-Bearings airframe rolling-Single row self-aligning roller bearings in steel-Dimensions and loads《航空航天系列 机身滚动轴承 单列自调准钢滚柱轴承 尺寸和负载》.pdf DS EN 3053-1994 Aerospace series-Bearings airframe rolling-Single row self-aligning roller bearings in steel-Dimensions and loads《航空航天系列 机身滚动轴承 单列自调准钢滚柱轴承 尺寸和负载》.pdf
  • DS EN 3054-1994 Aerospace series-Bearings airframe rolling-Single row self-aligning roller bearings in steel cadmium plated-Dimensions and loads《航空航天系列 机身滚动轴承 单列自调准镀镉钢滚柱轴承 尺寸和负载》.pdf DS EN 3054-1994 Aerospace series-Bearings airframe rolling-Single row self-aligning roller bearings in steel cadmium plated-Dimensions and loads《航空航天系列 机身滚动轴承 单列自调准镀镉钢滚柱轴承 尺寸和负载》.pdf
  • DS EN 3055-1994 Aerospace series-Bearings airframe rolling-Single row self-aligning roller bearings in corrosion resisting steel-Dimensions and loads《航空航天系列 机身滚动轴承 单列自调准不锈钢滚柱轴承 尺寸和.pdf DS EN 3055-1994 Aerospace series-Bearings airframe rolling-Single row self-aligning roller bearings in corrosion resisting steel-Dimensions and loads《航空航天系列 机身滚动轴承 单列自调准不锈钢滚柱轴承 尺寸和.pdf
  • DS EN 3056-1994 Aerospace series-Bearings airframe rolling-Rigid double row ball bearings in steel-Dimensions and loads《航空航天系列 机身滚动轴承 双列刚性钢滚珠轴承 尺寸和负载》.pdf DS EN 3056-1994 Aerospace series-Bearings airframe rolling-Rigid double row ball bearings in steel-Dimensions and loads《航空航天系列 机身滚动轴承 双列刚性钢滚珠轴承 尺寸和负载》.pdf
  • 相关搜索

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

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