急啊,各位C语言高手请帮忙看看这个程序为什么老有warning~~
#include<stdio.h>#include<math.h>main(){FILE*fp1,*fp2;floata,b,c,d,x0,x,f,f1;if((fp1=...
#include<stdio.h>
#include<math.h>
main()
{
FILE *fp1,*fp2;
float a,b,c,d,x0,x,f,f1;
if((fp1=fopen("xs.dat","r"))==NULL)
{
printf("Can't open file\n");
exit(0);
}
if((fp2=fopen("jg.dat","w"))==NULL)
{
printf("Can't open file\n");
exit(0);
}
fscanf(fp1,"%f,%f,%f,%f,%f",&a,&b,&c,&d,&x0);
x=x0;
do
{
x0=x;
f=((a*x0+b)*x0+c)*x0+d;
f1=(3*a*x0+2*b)*x0+c;
x=x0-f/f1;
fprintf(fp2,"%f, ",x);
}
while(fabs(x-x0)>=1E-5);
fclose(fp1);
fclose(fp2);
}
一编译就说'exit' undefined; assuming extern returning int 什么意思,怎么改? 展开
#include<math.h>
main()
{
FILE *fp1,*fp2;
float a,b,c,d,x0,x,f,f1;
if((fp1=fopen("xs.dat","r"))==NULL)
{
printf("Can't open file\n");
exit(0);
}
if((fp2=fopen("jg.dat","w"))==NULL)
{
printf("Can't open file\n");
exit(0);
}
fscanf(fp1,"%f,%f,%f,%f,%f",&a,&b,&c,&d,&x0);
x=x0;
do
{
x0=x;
f=((a*x0+b)*x0+c)*x0+d;
f1=(3*a*x0+2*b)*x0+c;
x=x0-f/f1;
fprintf(fp2,"%f, ",x);
}
while(fabs(x-x0)>=1E-5);
fclose(fp1);
fclose(fp2);
}
一编译就说'exit' undefined; assuming extern returning int 什么意思,怎么改? 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询