0

So I managed to get everything working right except for one thing, when I enter the following input:

a = 2

b = 2

c = 2

I should be getting this:

Root 1 = -0.5 + 0.866025i

Root 2 = -0.5 - 0.866025i

But I get this:

Root 1 = -1.#IND

Root 2 = -1.#IND

I'm at a loss here trying to figure out how to get the output to display like it should, hope you guys can help.

```
#include <iostream>
using namespace std;
#include <stdlib.h>
int main()
{
double a;
double b;
double c;
cout << "Enter number for a: ";
cin >> a;
cout << "Enter number for b: ";
cin >> b;
cout << "Enter number for c: ";
cin >> c;
if (a == 0 || b == 0 || c == 0)
{
cerr << "0 is an invalid input" << endl;
}
else
{
double root_1 = (-b + sqrt(b * b - 4 * a * c)) / (2 * a);
double root_2 = (-b - sqrt(b * b - 4 * a * c)) / (2 * a);
cout << "Root 1: " << root_1 << endl;
cout << "Root 2: " << root_2 << endl << endl;
}
return 0;
}
```