c++编程题! 用二分法求方程x2-2-x=0在[0,3]区间的根。要求误差不大于10-5

日期:2017-04-17 12:42:10 人气:1

c++编程题! 用二分法求方程x2-2-x=0在[0,3]区间的根。要求误差不大于10-5

#include "stdio.h"#include "math.h"double fun(double x) { return x*x-x-2; }double root(double a, double b, double e){ double x1,x2,y1,y2,x; x1=a; x2=b; do { x = (x1 + x2)/2; y = fun(x); y1 = fu
    A+
热门评论