?? 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 + -