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

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

1、计算机三级(信息管理技术)上机考试 30 及答案解析(总分:-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) ma

2、in() 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)_计算机三级(信息管理技术)上机考试 30 答案解析(总分:-1.00,做题时间:90 分钟)1.请编写函数 countValue(),它的功能是:求 n 以内(不包括

3、 n)同时能被 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(); progReadWr

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

展开阅读全文
相关资源
猜你喜欢
  • ONORM EN 10163-1-1992 Delivery requirements for surface condition of hot rolled steel plales wide flats and sections -General requirements《热轧钢板、宽扁钢和型钢的表面条件的交货要求 一般要求》.pdf ONORM EN 10163-1-1992 Delivery requirements for surface condition of hot rolled steel plales wide flats and sections -General requirements《热轧钢板、宽扁钢和型钢的表面条件的交货要求 一般要求》.pdf
  • ONORM EN 10163-2-1992 Delivery requirements for surface condition of hot rolled steel plates wide flats and sections -Plate and wide flats《热轧钢板、宽扁钢和型钢的表面条件的交货要求 钢板和宽扁钢》.pdf ONORM EN 10163-2-1992 Delivery requirements for surface condition of hot rolled steel plates wide flats and sections -Plate and wide flats《热轧钢板、宽扁钢和型钢的表面条件的交货要求 钢板和宽扁钢》.pdf
  • ONORM EN 10163-3-1992 Delivery requirements for surface condition of hot rolled steel plates wide f lats and sections -Sections《热轧钢板、宽扁钢和型钢的表面条件的交货要求 型钢》.pdf ONORM EN 10163-3-1992 Delivery requirements for surface condition of hot rolled steel plates wide f lats and sections -Sections《热轧钢板、宽扁钢和型钢的表面条件的交货要求 型钢》.pdf
  • ONORM EN 10164-1993 Steel products with improved deformation properties perpendicular lo the surface of the product - Technical dehvery conditions《改进表面垂直变形特性的钢铁产品 技术交付条件》.pdf ONORM EN 10164-1993 Steel products with improved deformation properties perpendicular lo the surface of the product - Technical dehvery conditions《改进表面垂直变形特性的钢铁产品 技术交付条件》.pdf
  • ONORM EN 102-1992 Ceramic tiles - Determination of resistance to deep abrasion - Unglazed tiles《瓷砖 抗极度磨损的测量 无釉瓷砖》.pdf ONORM EN 102-1992 Ceramic tiles - Determination of resistance to deep abrasion - Unglazed tiles《瓷砖 抗极度磨损的测量 无釉瓷砖》.pdf
  • ONORM EN 10203-1991 Cold reduced electronic tinplate《冷轧电镀锡薄钢板》.pdf ONORM EN 10203-1991 Cold reduced electronic tinplate《冷轧电镀锡薄钢板》.pdf
  • ONORM EN 10204-1992 Metallic products - Types of inspection documents《金属制品 检验文件的类型》.pdf ONORM EN 10204-1992 Metallic products - Types of inspection documents《金属制品 检验文件的类型》.pdf
  • ONORM EN 10205-1992 Cold reduced blackplate in coil form for the production of tinplate or electrolytic chromium chromium oxide coated stee!《生产马口铁或电解铬 氧化铬涂层钢的卷状冷轧黑钢板》.pdf ONORM EN 10205-1992 Cold reduced blackplate in coil form for the production of tinplate or electrolytic chromium chromium oxide coated stee!《生产马口铁或电解铬 氧化铬涂层钢的卷状冷轧黑钢板》.pdf
  • ONORM EN 10207-1992 Steels for simple pressure vessels -Technical delivery requirements for plates Strips and bars《简单压力容器用钢 钢板、钢条和钢棒的技术交货要求》.pdf ONORM EN 10207-1992 Steels for simple pressure vessels -Technical delivery requirements for plates Strips and bars《简单压力容器用钢 钢板、钢条和钢棒的技术交货要求》.pdf
  • 相关搜索

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

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