【计算机类职业资格】计算机三级(网络技术)上机考试9及答案解析.doc

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

1、计算机三级(网络技术)上机考试 9 及答案解析(总分:-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(

2、) clrscr(); printf(“自然数之和的平方根=%f/n“, countValue(1000); progReadWrite(); progReadWrite() FILE *wf; int i, n; float s; wf = fopen(“OUT11.DAT“, “w“); s = countValue(1000); fprintf(wf, “%f/n“, s); fclose(wf); (分数:-1.00)_计算机三级(网络技术)上机考试 9 答案解析(总分:-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(“自然数之和的平方根=%f/n“, countValue(1000); progReadWrite(); progReadWrite

4、) FILE *wf; int i, n; float s; wf = fopen(“OUT11.DAT“, “w“); s = countValue(1000); fprintf(wf, “%f/n“, 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 的值进行求平方根的计算,并把所求得的结果作为函数值返回。

展开阅读全文
相关资源
猜你喜欢
  • DIN EN 14532-1-2005 Welding consumables - Test methods and quality requirements - Part 1 Primary methods and conformity assessment of consumables for steel nickel and nickel alloys.pdf DIN EN 14532-1-2005 Welding consumables - Test methods and quality requirements - Part 1 Primary methods and conformity assessment of consumables for steel nickel and nickel alloys.pdf
  • DIN EN 14532-2-2005 Welding consumables - Test methods and quality requirements - Part 2 Supplementary methods and conformity assessment of consumables for steel nickel and nickel .pdf DIN EN 14532-2-2005 Welding consumables - Test methods and quality requirements - Part 2 Supplementary methods and conformity assessment of consumables for steel nickel and nickel .pdf
  • DIN EN 14532-3-2005 Welding consumables - Test methods and quality requirements - Part 3 Conformity assessment of wire electrodes wires and rods for welding of aluminium alloys Ger.pdf DIN EN 14532-3-2005 Welding consumables - Test methods and quality requirements - Part 3 Conformity assessment of wire electrodes wires and rods for welding of aluminium alloys Ger.pdf
  • DIN EN 14533-2015 Textiles and textile products - Burning behaviour of bedding items - Classification scheme German version EN 14533 2015《纺织材料和产品 窗上用品的燃烧特性 分类表 德文版本EN 14533-2015》.pdf DIN EN 14533-2015 Textiles and textile products - Burning behaviour of bedding items - Classification scheme German version EN 14533 2015《纺织材料和产品 窗上用品的燃烧特性 分类表 德文版本EN 14533-2015》.pdf
  • DIN EN 14534-2017 Postal services - Quality of service - Measurement of the transit time of end-to-end services for bulk mail German version EN 14534 2016《邮政服务 服务质量 批量邮件点对点服务运送时间的测.pdf DIN EN 14534-2017 Postal services - Quality of service - Measurement of the transit time of end-to-end services for bulk mail German version EN 14534 2016《邮政服务 服务质量 批量邮件点对点服务运送时间的测.pdf
  • DIN EN 14535-1-2011 Railway applications - Brake discs for railway rolling stock - Part 1 Brake discs pressed or shrunk onto the axle or drive shaft dimensions and quality requirem.pdf DIN EN 14535-1-2011 Railway applications - Brake discs for railway rolling stock - Part 1 Brake discs pressed or shrunk onto the axle or drive shaft dimensions and quality requirem.pdf
  • DIN EN 14535-2-2011 Railway applications - Brake discs for railway rolling stock - Part 2 Brake discs mounted onto the wheel dimensions and quality requirements German version EN 1.pdf DIN EN 14535-2-2011 Railway applications - Brake discs for railway rolling stock - Part 2 Brake discs mounted onto the wheel dimensions and quality requirements German version EN 1.pdf
  • DIN EN 14535-3-2016 Railways applications - Brake discs for railway rolling stock - Part 3 Brake discs performance of the disc and the friction couple classification German version.pdf DIN EN 14535-3-2016 Railways applications - Brake discs for railway rolling stock - Part 3 Brake discs performance of the disc and the friction couple classification German version.pdf
  • DIN EN 14538-2006 de 4066 Fat and oil derivatives - Fatty acid methyl ester (FAME) - Determination of Ca K Mg and Na content by optical emission spectral analysis with inductively .pdf DIN EN 14538-2006 de 4066 Fat and oil derivatives - Fatty acid methyl ester (FAME) - Determination of Ca K Mg and Na content by optical emission spectral analysis with inductively .pdf
  • 相关搜索

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

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