#include<iostream>
#include <math.h>
using namespace std;
int main()
{
double a,b,c,d,x,y;
cout<<"欢迎使用锤子Ethan解方程,一般式为ax^2+bx+c=0"<<endl;
cout<<"请输入系数a,b,c。"<<endl;
cin>>a>>b>>c;
cout<<"你输入的方程是"<<a<<"x^2+"<<b<<"x+"<<c<<"=0"<<endl;
d=b*b-4*a*c;
if(d>=0)
{
if(d>0)
{
x=((-b)+sqrt(d))/(2*a);
y=((-b)-sqrt(d))/(2*a);
cout<<"方程有两个解"<<"\t"<<x<<"\t"<<y<<endl;
}
else
{
x=((-b)+sqrt(d))/(2*a);
cout<<"方程有一个的根:"<<x<<endl;
}
}
else
cout<<"这个方程没有实数解"<<endl;
return 0;
}