大佬们帮忙debug下,谢大佬!!!yyds!!!
代码如下:
#include <bits/stdc++.h>
using namespace std;
int main()
{
double a, b, c, d, cnt;
cin >> a >> b >> c >> d;
for (double x = -100; x <= 100; x += 0.001)
{
if (a * x * x * x + b * x * x + c * x + d == 0)
{
cnt += 1;
cout << x << ' ';
}
if (cnt == 3)
{
break;
}
}
return 0;
}