标题:我想编写一个求方程 ax^2+bx+c=0 的根的程序。求大侠帮忙看一下哪里错误了。 ...
取消只看楼主
balancad
Rank: 1
等 级:新手上路
帖 子:19
专家分:6
注 册:2014-4-21
结帖率:80%
 问题点数:0 回复次数:0 
我想编写一个求方程 ax^2+bx+c=0 的根的程序。求大侠帮忙看一下哪里错误了。
#include<stdio.h>
#include<math.h>
int main()
{
    double a, b, c, dis,x, x1, x2;
    char i;
    scanf_s("%f %f %f", &a, &b, &c);
    dis = b*b-4*a*c;
    if (a == 0)x = --c / b;
    else if (dis >= 0)x1 = -b / 2 * a + sqrt(dis) / 2 * a, x2 = -b / 2 * a - sqrt(dis) / 2 * a;
    else if (dis < 0)dis = -dis, x1 = -b / 2 * a + sqrt(dis) / 2 * a i; , x2 = -b / 2 * a - sqrt(dis) / 2 * a i;
    return 0;
}
搜索更多相关主题的帖子: include double return 
2014-04-21 20:26



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-430425-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.430511 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved