C语言用二分法求解方程解,C语言二分法解方程,急!谢谢!

满意答案

00e27ab806e4881f8254fe7ae8741834.png

w616041189

2014.06.24

00e27ab806e4881f8254fe7ae8741834.png

采纳率:46%    等级:11

已帮助:6652人

本题的一个完整的c程序如下,程序在win-tc下调试通过,结果正确。 #include #include #include #include int n; double c[16]; double Func(double); int BisectRoot(double,double,double,double,double *,int,int *); int main() { int i,m; double a,b,h,eps,*x; printf("Please input integer k:\n"); scanf("%d",&n); /*方程根的个数的预估值*/ printf("Please input %d coefficients one by one:\n",n+1); for(i=0;i<=n;i++) scanf("%lf",&c[i]); x = (double*)calloc(n,sizeof(double)); /*开辟内存空间*/ if(x == NULL) { printf("内存分配失败\n"); exit(1); } a = -10; /*区间起始端点*/ b = 10; /*区间终止端点*/ h = 0.1; /*步长*/ eps = 1.e-5; /*要求达到的精度*/ BisectRoot(a,b,h,eps,x,n,&m); /*调用二分法函数*/ printf("The roots between %2.0f and %2.0f are: %d\n",a,b,m); printf("They are:\n"); for(i = 0;ib+h/2)||(*m==n)) return(1); if(fabs(y)

查看原帖>>

01分享举报

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值