资源预览内容
第1页 / 共2页
第2页 / 共2页
亲,该文档总共2页全部预览完了,如果喜欢就下载吧!
资源描述
/用弦截法求方程飞f(x)=x*x*x-5*x*x+16*x-80=0#include#includefloat f(float x)float y;y=(x-5.0)*x+16.0)*x-80.0;return y;float xpoint(float x1,float x2)float x;x=(x*f(x2)-x2*f(x1)/(f(x2)-f(x1);return x;float root(float x1,float x2)float x,y,y1;y1=f(x1);dox=xpoint(x1,x2);y=f(x);if(y*y10)y1=y;x1=x;elsex2=x;while(fabs(y)=0.0001);return x;void main()float x1,x2,f1,f2,x;doprintf(input x1,x2:n);scanf(%f%f,&x1,&x2);f1=f(x1);f2=f(x2);while(f1*f2=0);x=root(x1,x2);printf(A root of equation is%8.4n,x);
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号