【计算机类职业资格】计算机三级数据库技术-108及答案解析.doc

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

1、计算机三级数据库技术-108 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.下列程序的功能是:利用如下的简单迭代方法求方程 cos(x)-x=0的一个实根。 x(n+1)=cos(xn) 迭代步骤如下: (1)取 x1初值为 0.0。 (2)x0=x1,把 x1的值赋给 x0。 (3)x1=cos(x0),求出一个新的 x1。 (4)若 x0-x1的绝对值小于 0.000001,执行步骤(5),否则执行步骤(2)。 (5)所求 x1就是方程 cos(x)-x=0的一个实根,作为函数值返回。 请编写函数 countValue()实现程序功能

2、最后调用函数 writeDAT(),把结果输出到文件 OUT.DAT中。 请勿改动主函数 main()和写函数 writeDAT()的内容。 试题程序 #includestdlib.h #includemath.h #includestdio.h void writeDAT(); float countValue() void main() system(“CLS“); printf(“实根=%fn“,countValue(); printf(“%fn“,cos(countValue()- countValue(); writeDAT(); void writeDAT() FILE* wf;

3、 wf=fopen(“OUT.DAT“,“w“); fprintf(wf,“%fn“,countValue(); fclose(wf); (分数:100.00)_计算机三级数据库技术-108 答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.下列程序的功能是:利用如下的简单迭代方法求方程 cos(x)-x=0的一个实根。 x(n+1)=cos(xn) 迭代步骤如下: (1)取 x1初值为 0.0。 (2)x0=x1,把 x1的值赋给 x0。 (3)x1=cos(x0),求出一个新的 x1。 (4)若 x0-x1的绝对值小于 0.000001,执

4、行步骤(5),否则执行步骤(2)。 (5)所求 x1就是方程 cos(x)-x=0的一个实根,作为函数值返回。 请编写函数 countValue()实现程序功能,最后调用函数 writeDAT(),把结果输出到文件 OUT.DAT中。 请勿改动主函数 main()和写函数 writeDAT()的内容。 试题程序 #includestdlib.h #includemath.h #includestdio.h void writeDAT(); float countValue() void main() system(“CLS“); printf(“实根=%fn“,countValue(); pr

5、intf(“%fn“,cos(countValue()- countValue(); writeDAT(); void writeDAT() FILE* wf; wf=fopen(“OUT.DAT“,“w“); fprintf(wf,“%fn“,countValue(); fclose(wf); (分数:100.00)_正确答案:()解析:Float countValue( ) float x0,x1=0.0; /*定义两个浮点型变量进行迭代*/ while(1) /*无条件循环*/ x0=x1; /*将 x1赋值给 x0*/ x1=cos(x0); /*求出新的 x1*/ if(fabs(x0-x1)1e-6) break; /*若 x0-x1的绝对值小于 0.000001,则结束循环*/ return x1; /*返回 x1 的值*/ 考点 本题考查数学计算问题。考查的知识点主要包括:C 语言循环结构,迭代算法,if 判断结构和逻辑表达式,浮点型数据的相等比较。 此题属于数学计算题型。题目要求实现函数 countValue()的功能。本题的解题思路是:首先通过一个无条件循环结构作为程序的主体,在该循环体中实现迭代运算,且当条件“x0-x1 的绝对值小于 0.000001“满足时,退出循环,停止计算,此时 x1就是要计算的结果,最后函数返回该结果。

展开阅读全文
相关资源
猜你喜欢
  • ITU-R S 1878-2010 Multi-carrier based transmission techniques for satellite systems《卫星系统用基于多载波的传输技术》.pdf ITU-R S 1878-2010 Multi-carrier based transmission techniques for satellite systems《卫星系统用基于多载波的传输技术》.pdf
  • ITU-R S 1897-2012 Cross-layer QoS provisioning in IP-based hybrid satellite-terrestrial networks《基于互联网协议的混合动力卫星地面网络中交叉层业务质量(QoS)》.pdf ITU-R S 1897-2012 Cross-layer QoS provisioning in IP-based hybrid satellite-terrestrial networks《基于互联网协议的混合动力卫星地面网络中交叉层业务质量(QoS)》.pdf
  • ITU-R S 1899-2012 Protection criteria and interference assessment methods for non-GSO inter-satellite links in the 23 183-23 377 GHz band with respect to the space research service.pdf ITU-R S 1899-2012 Protection criteria and interference assessment methods for non-GSO inter-satellite links in the 23 183-23 377 GHz band with respect to the space research service.pdf
  • ITU-R S 2029-2012 Statistical methodology to assess time-varying interference produced by a geostationary fixed-satellite service network of earth stations operating with MF-TDMA sce n.pdf ITU-R S 2029-2012 Statistical methodology to assess time-varying interference produced by a geostationary fixed-satellite service network of earth stations operating with MF-TDMA sce n.pdf
  • ITU-R S 2049-2013 Access procedures for fixed-satellite service occasional use transmissions to geostationary-satellite orbit space stations in the 4 6 GHz and 11-12 13 14 GHz FSS .pdf ITU-R S 2049-2013 Access procedures for fixed-satellite service occasional use transmissions to geostationary-satellite orbit space stations in the 4 6 GHz and 11-12 13 14 GHz FSS .pdf
  • ITU-R S 2062-0-2014 Carrier identification system for digital-modulation transmissions of fixed-satellite service occasional use carrier earth station transmissions using geostatio-12 .pdf ITU-R S 2062-0-2014 Carrier identification system for digital-modulation transmissions of fixed-satellite service occasional use carrier earth station transmissions using geostatio-12 .pdf
  • ITU-R S 2099-0-2016 Allowable short-term error performance for a satellite hypothetical reference digital path《卫星假想参考数字路径的允许短期误差性能》.pdf ITU-R S 2099-0-2016 Allowable short-term error performance for a satellite hypothetical reference digital path《卫星假想参考数字路径的允许短期误差性能》.pdf
  • ITU-R S 2112-0-2018 Guidelines to conduct bilateral coordination for explicit agreements in the frequency band 14 5-14 75 GHz for Regions 1 and 2 countries or in the frequency bandf.pdf ITU-R S 2112-0-2018 Guidelines to conduct bilateral coordination for explicit agreements in the frequency band 14 5-14 75 GHz for Regions 1 and 2 countries or in the frequency bandf.pdf
  • ITU-R S 352-4 FRENCH-1982 Hypothetical reference circuit for systems using analogue transmission in the fixed-satellite service《在卫星固定业务中使用模拟传输的系统的假设参考电路 4B2部分 性能及可用性》.pdf ITU-R S 352-4 FRENCH-1982 Hypothetical reference circuit for systems using analogue transmission in the fixed-satellite service《在卫星固定业务中使用模拟传输的系统的假设参考电路 4B2部分 性能及可用性》.pdf
  • 相关搜索

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

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