main.c(31) : fatal error C1004: unexpected end of file found(这是咋回事?)
# include <stdio.h>
# include <math.h>
float f(float x){
return(x*x*x-5*x*x+16*x-80);
}
float xpoint(float x1,float x2){
float x;
x = (x1*f(x2)-x2*f(x1))/(f(x2)-f(x1));
return x;
}
int main()
{
float x1, x2, y1, y2, x, y;
int count = 0;
do {
printf("Please enter x1 and x2:\n");
scanf("%f%f", &x1,&x2);
y1 = f(x1);
y2 = f(x2);
while(y1*y2>0);
do {
x = xpoint(x1,x2);
y = f(x);
if(y*y1>0) x1=x;
else x2=x;
count++;
} while (fabs(y)>0.000001);
printf("x=%f count=%d",x,count);
return 0;
}