/* quad_root.cpp This program takes in the three coefficients a, b and c of a quadratic equation ax^2 + bx + c =0 and outputs the real roots of the equation. */ #include #include using namespace std ; int main() { //for setting the nunmber of digits to be displayed after the decimal point. int n_digits = 1; cout.precision(n_digits); cout<< "This program takes in the three coefficients a,b and c of a quadratic equation ax^2 + bx + c =0 and outputs the real roots of the equation."<> a >> b >> c ; cout << "You entered a= " << a << ", b = " << b << " and c = " << c << endl; double d = sqrt( b*b - 4.0*a*c ) ; double r1 = (-b + d)/(2.0*a); double r2 = (-b - d)/(2.0*a); cout << " The roots are: " << r1 << " and " << r2<<" ." <