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

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

1、计算机三级(数据库技术)上机考试 22 及答案解析(总分:-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)_计算机三级(数据库技术)上机考试 22 答案解析(总分:-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 的值进行求平方根的计算,并把所求得的结果作为函数值返回。

展开阅读全文
相关资源
猜你喜欢
  • DIN 58397-2-2012 Production in optical engineering - Testing of lubricating greases for precision engineering and optical instruments - Part 2 Spreading《光学工程产品 精密机械和光学仪器用润滑脂的检验 第2部.pdf DIN 58397-2-2012 Production in optical engineering - Testing of lubricating greases for precision engineering and optical instruments - Part 2 Spreading《光学工程产品 精密机械和光学仪器用润滑脂的检验 第2部.pdf
  • DIN 58400-1984 Basic rack for involute teeth of cylindrical gears for fine mechanics《精密机械用渐开线圆柱齿轮基本齿形》.pdf DIN 58400-1984 Basic rack for involute teeth of cylindrical gears for fine mechanics《精密机械用渐开线圆柱齿轮基本齿形》.pdf
  • DIN 58405 Bb 1-1972 Spur gear drives for fine mechanics calculating sheet《精密加工用正齿轮传动装置 计算表》.pdf DIN 58405 Bb 1-1972 Spur gear drives for fine mechanics calculating sheet《精密加工用正齿轮传动装置 计算表》.pdf
  • DIN 58405-1-1972 Spur Gear Drives for Fine Mechanics Scope Definitions Principal Design Data Classification《精密机械用正齿轮传动装置 第1部分 适用范围、定义、主要设计数据、分类》.pdf DIN 58405-1-1972 Spur Gear Drives for Fine Mechanics Scope Definitions Principal Design Data Classification《精密机械用正齿轮传动装置 第1部分 适用范围、定义、主要设计数据、分类》.pdf
  • DIN 58405-2-1972 Spur Gear Drives for Fine Mechanics Gear Fit Selection Tolerances Allowances《精密机械用正齿轮传动装置 第2部分 传动装置配合选择、公差、容差》.pdf DIN 58405-2-1972 Spur Gear Drives for Fine Mechanics Gear Fit Selection Tolerances Allowances《精密机械用正齿轮传动装置 第2部分 传动装置配合选择、公差、容差》.pdf
  • DIN 58405-3-1972 Spur Gear Drives for Fine Mechanics Indication in Drawings Examples for Calculation《精密加工用正齿轮传动装置 图样上的标注 计算示例》.pdf DIN 58405-3-1972 Spur Gear Drives for Fine Mechanics Indication in Drawings Examples for Calculation《精密加工用正齿轮传动装置 图样上的标注 计算示例》.pdf
  • DIN 58405-4-1972 Spur Gear Drives for Fine Mechanics Tables《精密机械用正齿轮传动装置 第4部分 表格》.pdf DIN 58405-4-1972 Spur Gear Drives for Fine Mechanics Tables《精密机械用正齿轮传动装置 第4部分 表格》.pdf
  • DIN 58411-1987 Hobs for cylindrical fine pitch gears with modul 0 1 up to 1 mm《模数0 1至1mm 的圆柱形精密正齿轮加工用滚铣刀 》.pdf DIN 58411-1987 Hobs for cylindrical fine pitch gears with modul 0 1 up to 1 mm《模数0 1至1mm 的圆柱形精密正齿轮加工用滚铣刀 》.pdf
  • DIN 58412-1987 Basic rack tooth profile for gear tools for fine mechanics involute gears according DIN 58400 and DIN 867《精密机构用的齿轮工具的基本齿条齿形 符合德国标准(DIN)58400和(DIN)867的渐开线齿轮》.pdf DIN 58412-1987 Basic rack tooth profile for gear tools for fine mechanics involute gears according DIN 58400 and DIN 867《精密机构用的齿轮工具的基本齿条齿形 符合德国标准(DIN)58400和(DIN)867的渐开线齿轮》.pdf
  • 相关搜索

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

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