#include <iostream>
using namespace std;
int main()
{
int a, b, c, d, x1, x2;
cin >> a >> b >> c;
d = pow(b, 2) - 4 * a * c;
if (d < 0)
cout << "No real root";
else if (d > 0)
{
x1 = (-b + sqrt(d)) / (2 * a);
x2 = (-b - sqrt(d)) / (2 * a);
cout << "Two different roots x1=" << x1 << " , x2=" << x2;
}
else if (d == 0)
{
x1 = -b / (2 * a);
cout << "Two same roots x=" << x1;
}
return 0;
}
在VS中執行沒問題 但交出答案後CE