2.设计思路
3.程序流程图
4.代码实现
#include<bits/stdc++.h> int main() { float solution(float a, float b, float c, float d); float a, b, c, d, x; printf("ÇëÊäÈë·½³ÌµÄϵÊý£º"); scanf("%f %f %f %f", &a, &b, &c, &d); x=solution(a,b,c,d); printf("ËùÇ󷽳̵ĸùΪx=%f",x); } float solution(float a, float b, float c, float d) { float x0, x=1.5, f, fd, h; do{ x0=x; f=a*x0*x0*x0+b*x0*x0+c*x0+d; fd=3*a*x0*x0+2*b*x0+c; h=f/fd; x=x0-h; }while(fabs(x-x0)>=1e-5); return x; }