输入数据回车程序没反应
我只写了fun函数部分,其他是题目,但是输入数据没反应,求助
程序代码:#include <stdio.h>[local]1[/local]
#include <math.h>
double fun ( double eps)
{
int n=1;
double s=1.0;
while(s*n/(2*n-1)>=eps)
{
s=s+s*n/(2*n+1);
n++;
}
return 2*s;
}
main( )
{ double x;void NONO ();
printf("Input eps:") ;
scanf("%lf",&x); printf("\neps = %lf, PI=%lf\n", x, fun(x));
NONO();
}
void NONO ()
{/* 本函数用于打开文件,输入数据,调用函数,输出数据,关闭文件。 */
FILE *fp, *wf ;
int i ;
double x ;
fp = fopen("in.dat","r") ;
wf = fopen("out.dat","w") ;
for(i = 0 ; i < 10 ; i++) {
fscanf(fp, "%lf", &x) ;
fprintf(wf, "%lf\n", fun(x)) ;
}
fclose(fp) ;
fclose(wf) ;
}








