#include #include using namespace std; int main() { double a; double b; double c; double x1; double x2; double term; double a2; cout << " Type in the three coefficients" << endl; cout << " One per line" << endl; cin >> a; cin >> b; cin >> c; term = b * b - 4.0 * a * c ; a2 = a * 2.0 ; if ( term < 0.0 ) { cout << " Roots are complex" << endl; cout << " Calculation abandoned" << endl; } else if ( term > 0.0 ) { term = sqrt(term); x1 = ( -b + term ) / a2; x2 = ( -b - term ) / a2; cout << " Roots are " << endl; cout << x1 << endl; cout << x2 << endl; } else { x1 = -b/a2; cout << " Roots are equal" << endl; cout << x1; } return(0); }