编个C语言程序,用热二分法求方程x^3+4x-10=0 在区间[1,2]内的根(精确到0.00001)

学习 时间:2026-06-05 06:22:48 阅读:275
编个C语言程序,用热二分法求方程x^3+4x-10=0 在区间[1,2]内的根(精确到0.00001)

最佳回答

等待的花卷

秀丽的泥猴桃

2026-06-05 06:22:48

#include #include int main(int argc,char *argv[]){double a=1。0,b=2。0;double x;while(1){x=(a+b)/2;if (-0。00001 < pow(x,3)+4*x-10 && pow(x,3)+4*x-10 < 0。00001){break;}else if(pow(x,3)+4*x-10 < 0){a=x;}else if(pow(x,3)+4*x-10 > 0){b=x;}}printf("%f\n",x);printf("%f\n",pow(x,3)+4*x-10);system("PAUSE");return 0;}

最新回答共有2条回答

  • 矮小的未来
    回复
    2026-06-05 06:22:48

    #include #include int main(int argc,char *argv[]){double a=1。0,b=2。0;double x;while(1){x=(a+b)/2;if (-0。00001 < pow(x,3)+4*x-10 && pow(x,3)+4*x-10 < 0。00001){break;}else if(pow(x,3)+4*x-10 0){b=x;}}printf("%f\n",x);printf("%f\n",pow(x,3)+4*x-10);system("PAUSE");return 0;}

上一篇 帝王 用英文怎么说

下一篇 抛砖引玉的引是什么意思?