SOURCE

#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    double a,b,c,d;
    cin>>a>>b>>c;
    d=b*b-4*a*c;
    if(a==0)
    {
        cout<<"不是一元二次方程"<<endl;
    }
    else if(d>0)
    {
        double x1=(-b+sqrt(d))/(2*a);
        double x2=(-b-sqrt(d))/(2*a);
        cout<<"两个不相等实根:"<<x1<<" "<<x2<<endl;
    }
    else if(d==0)
    {
        double x=-b/(2*a);
        cout<<"两个相等实根:"<<x<<endl;
    }
    else
    {
        cout<<"无实根"<<endl;
    }
    return 0;
}
console 命令行工具 X clear

                    
>
console