【计算机类职业资格】计算机三级(网络技术)上机考试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 ISO 658-2002 Oilseeds - Determination of content of impurities (ISO 658 2002) German version EN ISO 658 2002《油籽 杂质含量的测定 (ISO 658 2002) 德文版本 EN ISO 658 2002》.pdf DIN EN ISO 658-2002 Oilseeds - Determination of content of impurities (ISO 658 2002) German version EN ISO 658 2002《油籽 杂质含量的测定 (ISO 658 2002) 德文版本 EN ISO 658 2002》.pdf
  • DIN EN ISO 6581-2010 Anodizing of aluminium and its alloys - Determination of the comparative fastness to ultraviolet light and heat of coloured anodic oxidation coatings (ISO 6581.pdf DIN EN ISO 6581-2010 Anodizing of aluminium and its alloys - Determination of the comparative fastness to ultraviolet light and heat of coloured anodic oxidation coatings (ISO 6581.pdf
  • DIN EN ISO 659-2009 Oilseeds - Determination of oil content (Reference method) (ISO 659 2009) English version of DIN EN ISO 659 2009-11《油料种子 油含量的测定(参考方式)(ISO 659 2009) 德文版本 EN ISO .pdf DIN EN ISO 659-2009 Oilseeds - Determination of oil content (Reference method) (ISO 659 2009) English version of DIN EN ISO 659 2009-11《油料种子 油含量的测定(参考方式)(ISO 659 2009) 德文版本 EN ISO .pdf
  • DIN EN ISO 660-2009 Animal and vegetable fats and oils - Determination of acid value and acidity (ISO 660 2009) English version of DIN EN ISO 660 2009-10《动植物脂肪和油 酸值和酸度的测定(ISO 660 2.pdf DIN EN ISO 660-2009 Animal and vegetable fats and oils - Determination of acid value and acidity (ISO 660 2009) English version of DIN EN ISO 660 2009-10《动植物脂肪和油 酸值和酸度的测定(ISO 660 2.pdf
  • DIN EN ISO 6603-1-2000 Plastics - Determination of puncture impact behaviour of rigid plastics - Part 1 Non-instrumented impact testing (ISO 6603-1 2000) German version EN ISO 6603.pdf DIN EN ISO 6603-1-2000 Plastics - Determination of puncture impact behaviour of rigid plastics - Part 1 Non-instrumented impact testing (ISO 6603-1 2000) German version EN ISO 6603.pdf
  • DIN EN ISO 6603-2-2002 Plastics - Determination of puncture impact behaviour of rigid plastics - Part 2 Instrumented puncture test (ISO 6603-2 2000) German version EN ISO 6603-2 20.pdf DIN EN ISO 6603-2-2002 Plastics - Determination of puncture impact behaviour of rigid plastics - Part 2 Instrumented puncture test (ISO 6603-2 2000) German version EN ISO 6603-2 20.pdf
  • DIN EN ISO 661 Berichtigung 1-2007 Animal and vegetable fats and oils - Preparation of test sample (ISO 661 2003) German version EN ISO 661 2005 Corrigenda to DIN EN ISO 661 2005-1.pdf DIN EN ISO 661 Berichtigung 1-2007 Animal and vegetable fats and oils - Preparation of test sample (ISO 661 2003) German version EN ISO 661 2005 Corrigenda to DIN EN ISO 661 2005-1.pdf
  • DIN EN ISO 661-2005 Animal and vegetable fats and oils - Preparation of test sample (ISO 661 2003) English version of DIN EN ISO 661 2005《动植物油脂 试样的制备》.pdf DIN EN ISO 661-2005 Animal and vegetable fats and oils - Preparation of test sample (ISO 661 2003) English version of DIN EN ISO 661 2005《动植物油脂 试样的制备》.pdf
  • DIN EN ISO 662-2016 Animal and vegetable fats and oils - Determination of moisture and volatile matter content (ISO 662 2016) German version EN ISO 662 2016《动植物脂肪和油脂 水分和挥发物含量测定(ISO.pdf DIN EN ISO 662-2016 Animal and vegetable fats and oils - Determination of moisture and volatile matter content (ISO 662 2016) German version EN ISO 662 2016《动植物脂肪和油脂 水分和挥发物含量测定(ISO.pdf
  • 相关搜索

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

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