标题:帮我找找错误
只看楼主
dreamhouse
Rank: 1
等 级:新手上路
帖 子:107
专家分:7
注 册:2011-12-16
结帖率:59.46%
 问题点数:0 回复次数:1 
帮我找找错误
#include<stdio.h>
#include<math.h>
int main()
{
    double a,b,c,disc,x1,x2,realpart,imagpart;
    scanf("%lf,%if,%if",&a,&b,&c);
    printf("The equation");
    if(fabs(a)<=0)
        printf("is not a quadratic\n");
    else
    {
        disc=b*b-4*a*c;
        if(fabs(disc)<=0)
            printf("has two equal roots:%8.4f\n",-b/(2*a));
        else
            if(disc>0)
            {
                x1=(-b+sqrt(disc)/(2*a);
                x2=(-b-sqrt(disc)/(2*a);
                printf("has distinct real roots: %8.4f and %8.4f\n",x1,x2);
            }
            else
            {
                realpart=-b/(2*a);
                imagpart=sqrt (-disc)/(2*a);
                printf("has complex roots:\n");
                printf("%8.4f+%8.4fi\n",realpart,imagpart);
                printf("%8.4f-%8.4fi\n:,realpart,imagpart);
            }
            
    }
    return 0;

}
搜索更多相关主题的帖子: equation include 
2012-08-12 20:22
TonyDeng
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:304
帖 子:25859
专家分:48889
注 册:2011-6-22
得分:0 
你为什么总不抬头看看置顶的必读帖,封了几次都死不改悔。我锁到你改为止!

授人以渔,不授人以鱼。
2012-08-12 20:29



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




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

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