#include<iostream>
#include <cmath>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
if (b*b-4*a*c<0)
{
cout<<"此方程无解。";
}
else if (b*b-4*a*c==0)
{
double x;
x=-b/(2*a);
cout<<"此方程解为:"<<x;
}
else
{
double x1,x2;
x1=(-b+sqrt(b*b-4*a*c))/(2*a);
x2=(-b-sqrt(b*b-4*a*c))/(2*a);
cout<<"此方程的解为:"<<x1<<"和"<<x2;
}
return 0;
}
10-14
2011
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交