Question: C++ Write a complete C++ program that inputs 3 real numbers denoting the coefficients a, b, and c for the quadratic equation ax^2 + bx

C++

Write a complete C++ program that inputs 3 real numbers denoting the coefficients a, b, and c for the quadratic equation ax^2 + bx + c = 0, solves for x, and outputs the real root solution(s). For example, given the input

1.2 2.0 3.0

Your program should output the 2 real roots followed by a newline (C++ endl):

-0.8, -2.5

If the discriminant is 0.0, then there is only one real root, and your program should output exactly one value. For example, given the input

2.0 4.0 3.0

Your program should output

one real root: -1

Finally, if the discriminant is negative, then there are no real roots, and your program should say so. For example, given the input

1.0 2.0 3.0

Your program should output

no real roots

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!