注意:源程序存放在考生文件夹下的BLANK1.C中。不得增行或删行,也不得更改程序的结构!
给定源程序:
#include
#include
double fun(double x)
{double f, t; int n;
f = 1.0 + x;
/**********found**********/
t = ___1___;
n = 1;
do {
n++;
/**********found**********/
t *= (-1.0)*x/___2___;
f += t;
}
/**********found**********/
while (___3___ >= 1e-6);
return f;
}
main()
{double x, y;
x=2.5;
y = fun(x);
printf("\nThe result is :\n");
printf("x=%-12.6f y=%-12.6f\n", x, y);
}
解题答案:
/**********第一空**********/
t = x;
/**********第二空**********/
t *= (-1.0)*x/n ;
/**********第三空**********/
while (fabs(t)>= 1e-6);
******************************************
更多此系列试题汇总:
相关专题:
相关推荐: