Write a C++ program that will announce the number of real roots of the equation for various user-provided values of a, b, and c, and then computes and announces the real roots (if any).
1. Prompt the user for three values: a, b, and c.
Please enter an integer value for a: ->
Please enter an integer value for b: ->
Please enter an integer value for c: ->
2. Compute the value of the discriminant and announce the results as they pertain to the number of roots.
Remember that the discriminant of the quadratic equation is the value of the arithmetic expression under the radical:
b2 – 4 a c
Clearly, you must use the arithmetic operator for multiplication and the assignment operator to store the computed value into a variable. The value if the discriminant is: positive – two real roots zero – one real root negative – no real roots. Once you have computed this value, announce the number of roots you will compute.
3. Compute and announce the roots of the equation, if any. To compute a square root use the sqrt() function from the math library so include the math library: #include.
Later in your program you can do this: double discriminant = … (1) double root = sqrt(discriminant); (2) If discriminant were assigned 25 when its value was computed at (1), then root will have the value 5 after (2) executes!!! Isn’t that great??