题目:
题解:
#include <stdio.h>
double fun ( double h )
{
}
main( )
{ double a;void NONO ();
printf ("Enter a: "); scanf ("%lf", &a );
printf ( "The original data is : " );
printf ( "%f \n\n", a);
printf ( "The result : %f\n", fun(a));
NONO( );
}
void NONO ()
{/* 请在此函数内打开文件,输入测试数据,调用 fun 函数,
输出数据,关闭文件。 */
int i ;
double a ;
FILE *rf, *wf ;
rf = fopen("in.dat","r") ;
wf = fopen("out.dat","w") ;
for(i = 0 ; i < 20 ; i++) {
fscanf(rf, "%lf", &a) ;
fprintf(wf, "%f\n", fun(a)) ;
}
fclose(rf) ;
fclose(wf) ;
}
标签:四舍五入,wf,NONO,double,C语言,rf,printf,fun
From: https://blog.csdn.net/2301_79580018/article/details/141039249