📄 8-12.cpp
字号:
/*3208006411*/
#include<stdio.h>
#include<math.h>
void main()
{float solut(float a,float b,float c,float d);
float a,b,c,d;
printf("input a,b,c,d:");
scanf("%f,%f,%f,%f,%f",&a,&b,&c,&d);
printf("x=%10.7f\n",solut(a,b,c,d));
}
float solut(float a,float b,float c,float d)
{float x=1,x0,f,f1;
do
{x0=x;
f=((a*x0+b)*x0+c)*x0+d;
f1=(3*a*x0+a*b)*x0+c;
x=x0-f/f1;
}
while(fabs(x-x0)>=1e-3);
return(x);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -