#include <stdio.h>
#include <math.h>
int main()
{
double solut(double ,double ,double ,double );
double a,b,c,d;
scanf("%lf%lf%lf%lf",&a,&b,&c,&d);
printf("%.2f",solut(a,b,c,d));
return 0;
}
double solut(double a,double b,double c,double d)
{
double x1=1,x0;
double f(double a,double b,double c,double d,double x);
double f_1(double a,double b,double c,double x);
double y(double x);
while(fabs(x1-x0)>=1e-5)
{
x0=x1;
x1=x1-f(a,b,c,d,x1)/f_1(a,b,c,x1);
//函数调用中的变量顺序弄错了
}
return x1;
}
//我错误地理解为f(x)和0的差表示精度。。。
double f(double a,double b,double c,double d,double x)
{
return ((((a*x)+b)*x+c)*x+d);
}
double f_1(double a,double b,double c,double x)
{
return ((3*a*x*+2*b)*x+c);
}
#include <stdio.h>
#include <math.h>
int main()