- 4
- 0
- 约1.15万字
- 约 16页
- 2017-06-05 发布于河南
- 举报
2级C语言上机题 1(国外英文资料)
2级C语言上机题 1
A selection of test questions on the secondary C language
Write function fun, which USES the simple iterative method shown below to solve the equation: a real root of cosine of x minus x = 0.
Xn + 1 = cos (xn) iteration steps are as follows:
(1) the initial value of x1 is 0.0;
(2) x0 = x1, the value of x1 is given to x0;
(3) x1 = cos (x0), find a new x1;
(4) if the absolute value of x0 minus x1 is less than 0.000001, the execution step (5), otherwise the execution step (2);
(5) the x1 is the actual root of the equation cosine of x, minus x is equal to 0, and it returns as a function.
Double x1 = 0.0;
The do
{x0 = x1; X1 = cos (x0); }
While (fabs (x0-x1) = 0.000001);
Return the x;
2, write the function double fun, and its function is to calculate s by the following formula. The n is passed in through the form.
1, 1, 1, 1, 1
+ S = ─ ─ - ─ ─ ─ ─ - ─ ─ +... ─ ─ ─ ─ ─
1, 3, 5, 7, 2n + 1
Int I, j = 1; Double s = 0;
For (I = 0; I = n; I + +)
{s = s + 1.0 / (2 * I + 1) * j; J = - j; }
* sn = s;
Write the function double fun, which is the function of finding the value of P according to the following formula, which is returned by the function value. M and n are two positive integers and they want m n.
M!
P = ─ ─ ─ ─ ─
N! (m, n)!
Double I = 1, x = 1, y = 1, z = 1, p = 0;
For (I = 1;)
For (I = 1;)
For (I = 1; I = (m - n);
P = x/(y * z);
Return the p;
Write function fun, and its function is to compute: s = [ln (1) + ln (2) + ln (3) +... + ln (m)] 0.5
The log (n) function in C is called ln (n). The log functions reference is: double log (double x);
Double I, s = 0;
For (I = 1; I = m; I + +) s = s + log (I);
Return SQRT (s);
Write the function double fun (double h), which functions: rounding and retaining two decimal places
Long int I, j = 1;
If (h 0) {j = -1; H = - h; }
H = h * 100 + 0.5;
I = h;
H = I / 100.0;
Return h * j;
Write function fun. The function is to find the smallest number greater than t in the Fibonacci sequence, and the result is returned by the f
您可能关注的文档
最近下载
- 企业研发活动统计107-1、107-2报表版整理版(2021年-2022年).pdf VIP
- XX中学校2026年春季学期安全工作计划与应急演练安排表.docx VIP
- 园林植物配置与应用PPT课件.pptx VIP
- DB33/1006-2017 浙江省住宅设计标准.docx VIP
- HGT 4684-2014 液氯泄漏的处理处置方法.docx VIP
- IMT_2030(6G)推进组-通信行业:6G可信内生安全架构研究报告.docx VIP
- 亨格瑞成本与管理会计(第16版) 课件 Chapter 1 The Manager and Management Accounting .pptx
- 人教版高中化学选择性必修第2册 第三章 晶体结构与性质 第三节 金属晶体与离子晶体(一).ppt VIP
- 2025年全媒体运营师全媒体5G传播应用与传统媒体传输方式对比专题试卷及解析.pdf VIP
- IMT_2030(6G)推进组-通信行业:6G通信感知一体化评估方法研究报告.docx VIP
原创力文档

文档评论(0)