#include<stdio.h>
#include<math.h>
int main(void)
{
    double x0,x1,eps,n,f(),df();
    printf("plase input x0=\n");
    scanf("%lf",&x0);

    printf("plase input eps=\n");
    scanf("%lf",&eps);

    n=0;
    do
    {
        x1=x0-(f(x0)/df(x0));
        if(fabs(f(x1)<eps))
        {
            printf("此时方程的解为:%lf\n",x1);
            printf("此时方程迭代%f次!\n",n);
            return 0;
        }
        x0=x1;
        n++;
    }
    while(df(x1)==0||n<100);
    {
        printf("迭代失败,程序终止!\n");
        return 0;
    }
}



double f(double x)
{
    double y;
    y=exp(2*x)+x-4;
    return y;
}
double df(double x)
{
    double y;
    y=2*exp(2*x)+1;
    return y;
}