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

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

1、三级数据库技术机试-195 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.请编写函数 findRoot(),其功能是:利用以下所示的简单迭代方法求方程 cos(x)-x=0 的一个实根。迭代步骤如下:(1)取 x1初值为 0.0。(2)把 x1的值赋给 x0,即 x0=x1。(3)求出一个新的 x1,即 x1=cos(x0)。(4)若 x0-x1的绝对值小于 0.000001,执行步骤(5),否则执行步骤(2)。(5)所求 x1就是方程 cos(x)-x=0 的一个实根,作为函数值返回。函数 writeData()负责把结果输出到 OUT

2、DAT 文件中。注意:部分源程序已给出。请勿改动主函数 main()和写函数 writeData()的内容。试题程序:#includestdlib.h#includemath.h#includestdio.hvoid writeData();float findRoot()float x1=0.00,x0;int i=0;dox0=x1;/将 x1 的值赋给 x0x1=cos(x0);/得到一个新的 x1 的值while(fabs(x1-x0)0.000001);/如果误差比所要求的值大,则继续循环return x1;void main()system(“CLS“);printf(“root

3、f“,findRoot();writeData();void writeData()FILE*wf;wf=fopen(“OUT.DAT“,“w“);fprintf(wf,“%f“,findRoot():fclose(wf);(分数:100.00)_三级数据库技术机试-195 答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.请编写函数 findRoot(),其功能是:利用以下所示的简单迭代方法求方程 cos(x)-x=0 的一个实根。迭代步骤如下:(1)取 x1初值为 0.0。(2)把 x1的值赋给 x0,即 x0=x1。(3)求出一个新的

4、 x1,即 x1=cos(x0)。(4)若 x0-x1的绝对值小于 0.000001,执行步骤(5),否则执行步骤(2)。(5)所求 x1就是方程 cos(x)-x=0 的一个实根,作为函数值返回。函数 writeData()负责把结果输出到 OUT.DAT 文件中。注意:部分源程序已给出。请勿改动主函数 main()和写函数 writeData()的内容。试题程序:#includestdlib.h#includemath.h#includestdio.hvoid writeData();float findRoot()float x1=0.00,x0;int i=0;dox0=x1;/将 x

5、1 的值赋给 x0x1=cos(x0);/得到一个新的 x1 的值while(fabs(x1-x0)0.000001);/如果误差比所要求的值大,则继续循环return x1;void main()system(“CLS“);printf(“root=%f“,findRoot();writeData();void writeData()FILE*wf;wf=fopen(“OUT.DAT“,“w“);fprintf(wf,“%f“,findRoot():fclose(wf);(分数:100.00)_正确答案:(float findRoot()float x1=0.00,x0;int i=0;dox0=x1;/将 x1 的值赋给 x0x1=cos(x0);/得到一个新的 x1 的值while(fabs(x1-x0)0.000001);/如果误差比所要求的值大,则继续循环return x1;)解析:解析 本题主要考查方程的数值解法。题目较简单,按照题目中所给的流程即可很快编出程序。

展开阅读全文
相关资源
猜你喜欢
  • BS DD CLC TS 50537-1-2010 Railway applications - Mounted parts of the traction transformer and cooling system - HV bushing for traction transformers《轨道交通 牵引变压器和冷却系统的装配部件 牵引变压器用高压套管.pdf BS DD CLC TS 50537-1-2010 Railway applications - Mounted parts of the traction transformer and cooling system - HV bushing for traction transformers《轨道交通 牵引变压器和冷却系统的装配部件 牵引变压器用高压套管.pdf
  • BS DD CLC TS 50537-2-2010 Railway applications - Mounted parts of the traction transformer and cooling system - Pump for insulating liquid for traction transformers and reactors《轨道.pdf BS DD CLC TS 50537-2-2010 Railway applications - Mounted parts of the traction transformer and cooling system - Pump for insulating liquid for traction transformers and reactors《轨道.pdf
  • BS DD CLC TS 50537-3-2010 Railway applications - Mounted parts of the traction transformer and cooling system - Water pump for traction converters《轨道交通 牵引变压器和冷却系统的装配部件 牵引变流器用水泵》.pdf BS DD CLC TS 50537-3-2010 Railway applications - Mounted parts of the traction transformer and cooling system - Water pump for traction converters《轨道交通 牵引变压器和冷却系统的装配部件 牵引变流器用水泵》.pdf
  • BS DD CLC TS 50537-4-2010 Railway applications - Mounted parts of the traction transformer and cooling system - Gas and liquid actuated (Buchholz) relay for liquid immersed transfo.pdf BS DD CLC TS 50537-4-2010 Railway applications - Mounted parts of the traction transformer and cooling system - Gas and liquid actuated (Buchholz) relay for liquid immersed transfo.pdf
  • BS DD CLC TS 50539-22-2010 Low-voltage surge protective devices - Surge protective devices for specific application including d c Selection and application principles - Wind turbin.pdf BS DD CLC TS 50539-22-2010 Low-voltage surge protective devices - Surge protective devices for specific application including d c Selection and application principles - Wind turbin.pdf
  • BS DD CLC TS 50544-2010 Low voltage d c surge protective device for traction systems - Selection and application rules for surge arresters《牵引系统用低压直流雷击防护装置 避雷器选择和应用规则》.pdf BS DD CLC TS 50544-2010 Low voltage d c surge protective device for traction systems - Selection and application rules for surge arresters《牵引系统用低压直流雷击防护装置 避雷器选择和应用规则》.pdf
  • BS DD CLC TS 60034-18-33-2011 Rotating electrical machines Functional evaluation of insulation systems Test procedures for form-wound windings Multifactor evaluation by endurance u.pdf BS DD CLC TS 60034-18-33-2011 Rotating electrical machines Functional evaluation of insulation systems Test procedures for form-wound windings Multifactor evaluation by endurance u.pdf
  • BS DD CLC TS 60034-20-1-2004 Rotating electrical 60034-20-1 2004) machines - Part 20-1 Control motors - Stepping motors《旋转电机 控制电动机 步进电动机》.pdf BS DD CLC TS 60034-20-1-2004 Rotating electrical 60034-20-1 2004) machines - Part 20-1 Control motors - Stepping motors《旋转电机 控制电动机 步进电动机》.pdf
  • BS DD CLC TS 60034-24-2011 Rotating electrical machines Online detection and diagnosis of potential failures at the active parts of rotating electrical machines and of bearing curr.pdf BS DD CLC TS 60034-24-2011 Rotating electrical machines Online detection and diagnosis of potential failures at the active parts of rotating electrical machines and of bearing curr.pdf
  • 相关搜索

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

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