【计算机类职业资格】计算机三级(数据库技术)上机考试27及答案解析.doc

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

1、计算机三级(数据库技术)上机考试 27 及答案解析(总分:-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) mai

2、n() clrscr(); 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)_计算机三级(数据库技术)上机考试 27 答案解析(总分:-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(); progReadWrit

4、e() FILE *wf; 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 的值进行求平方根的计算,并把所求得的结果作为函数值返回。

展开阅读全文
相关资源
猜你喜欢
  • GOST ISO 445-2013 Means for the palletizatiop Pallets Terms apd definitions《货盘化方法 Rallets 术语和定义》.pdf GOST ISO 445-2013 Means for the palletizatiop Pallets Terms apd definitions《货盘化方法 Rallets 术语和定义》.pdf
  • GOST ISO 4635-2013 Preformed rubber joint seals for use between concrete paving sections of highways Technical requirements《高速公路混凝土铺路段之间用预压制橡胶密封件 技术要求》.pdf GOST ISO 4635-2013 Preformed rubber joint seals for use between concrete paving sections of highways Technical requirements《高速公路混凝土铺路段之间用预压制橡胶密封件 技术要求》.pdf
  • GOST ISO 4643-2013 Moulded plastics footwear Lined or unlined poly(vinyl chloride) boots for general industrial use Specification《模压塑料鞋靴 一般工业用内衬或者非内衬聚氯乙烯靴子 规格》.pdf GOST ISO 4643-2013 Moulded plastics footwear Lined or unlined poly(vinyl chloride) boots for general industrial use Specification《模压塑料鞋靴 一般工业用内衬或者非内衬聚氯乙烯靴子 规格》.pdf
  • GOST ISO 4656-2013 Rubber compounding ingredients Carbon black Determination of oil absorption number (OAN) and oil absorption number of compressed sample (COAN)《橡胶配合剂 炭黑 吸油量值 (OAN.pdf GOST ISO 4656-2013 Rubber compounding ingredients Carbon black Determination of oil absorption number (OAN) and oil absorption number of compressed sample (COAN)《橡胶配合剂 炭黑 吸油量值 (OAN.pdf
  • GOST ISO 4671-2013 Rubber or plastics hoses and hose assemblies Methods of measurement of the dimensions of hoses and the lengths of hose assemblies《橡胶或者塑料软管以及软管组合件 软管尺寸和软管组件长度的测量方.pdf GOST ISO 4671-2013 Rubber or plastics hoses and hose assemblies Methods of measurement of the dimensions of hoses and the lengths of hose assemblies《橡胶或者塑料软管以及软管组合件 软管尺寸和软管组件长度的测量方.pdf
  • GOST ISO 4731-2014 Essential oil of geranium (Pelargonium x ssp ) Specifications《天竺葵 (Pelargonium x ssp ) 精油 规格》.pdf GOST ISO 4731-2014 Essential oil of geranium (Pelargonium x ssp ) Specifications《天竺葵 (Pelargonium x ssp ) 精油 规格》.pdf
  • GOST ISO 5010-2011 Earth-moving machinery Steering requirements for rubber-tyred machines《土方机械 橡胶轮胎机械的转向要求》.pdf GOST ISO 5010-2011 Earth-moving machinery Steering requirements for rubber-tyred machines《土方机械 橡胶轮胎机械的转向要求》.pdf
  • GOST ISO 5017-2014 Dense shaped refractory products Determination of bulk density apparent porosity and true porosity《高密度成型耐火制品 体积密度 表观孔隙度和真实孔隙度的测定 》.pdf GOST ISO 5017-2014 Dense shaped refractory products Determination of bulk density apparent porosity and true porosity《高密度成型耐火制品 体积密度 表观孔隙度和真实孔隙度的测定 》.pdf
  • GOST ISO 5024-2013 Petroleum liquids and liquefied petroleum gases Measurements Standard reference conditions《石油液体和液化石油气 测量 标准参考条件》.pdf GOST ISO 5024-2013 Petroleum liquids and liquefied petroleum gases Measurements Standard reference conditions《石油液体和液化石油气 测量 标准参考条件》.pdf
  • 相关搜索
    资源标签

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

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