// Calculate the solutions to a quadratic equation

#include<iostream>
#include<cmath>
using namespace std;

int main (void)
{
    float a, b, c, radicand, root1, root2;

    // Prompt the user for the 3 coefficients
    cout << "Enter a b c => ";
    cin >> a >> b >> c;

    // Calculate the radicand
    radicand = b * b - 4 * a * c;

    // Assume the randicand is positive
    root1 = (-b + sqrt(radicand)) / (2 * a);
    root2 = (-b - sqrt(radicand)) / (2 * a);

    cout << "The roots are " << root1 << " and " << root2 << endl;

    return 0;
}

*****  Sample Run 1  *****

Enter a b c => 1 2 1
The roots are -1 and -1


*****  Sample Run 2  *****

Enter a b c => 1 3 2
The roots are -1 and -2


*****  Sample Run 3  *****

Enter a b c => 1.2 3.4 -5.6
The roots are 1.16667 and -4


*****  Sample Run 4  *****

Enter a b c => 1 2 3
The roots are nan and nan