#include<iostream>
#include<math.h>
using namespace std;
int fun(int x,int y,int z)
{
if(x==0&&y!=0)
cout<<"x="<<-c/b<<endl;
else if (y*y-4*x*z>=0)
return (y*y-4*x*z);
else return -1;
}
int main()
{
int a,b,c;
double x1,x2;
cout<<"请输入a,b,c的值"<<endl;
cin>>a>>b>>c;
if(fun(a,b,c)==-1)
cout<<"该方程无解"<<endl;
else
{
x1=(-b+sqrt((double)fun(a,b,c)))/(2*a);
x2=(-b-sqrt((double)fun(a,b,c)))/(2*a);
if (x1==x2)
cout<<"该方程的解为x1=x2="<<x1<<endl;
else
cout<<"该方程的解为x1="<<x1<<""<<"x2="<<x2<<endl;
}
return 0;
}