初学C 请问高手 有什么错误?谢谢啊
#include<stdio.h>#include<math.h>
#include<stdlib.h>
void main()
{
FILE *rf,*wf;
float a,b,c,d,e,f,g;
if((rf=fopen("data1.txt","r"))==NULL){printf("cannot open file1\n");exit(0);}
if((wf=fopen("result1.txt","w"))==NULL){printf("cannot open file2\n");exit(0);}
while(!feof(rf))
{
fscanf(rf,"%d%d",&a,&b);
{
f=a+b;
g=b-a;
c=sin(f);
d=log(b);
e=exp(g);
fprintf(wf,"a=%.2f\t b=%f\t c=%.2f\t d=%.2f\t e=%.2f\t ",a,b,c,d,e);
fprintf(wf,"\n\n");
}
fclose(rf);fclose(wf);
}
}