Answer to Question #41977 in C++ for fil

Question #41977
Write a function that will calculate and display the real roots of the quadratic equation
a?+ bx + c = 0
using the quadratic formula
-b f db2 - 4ac
X=
2a
Assume that a, b and c are floating-point arguments whose values are given, and that xl and x2 are floating-point
variables. Also, assume that 62 > 4*a*c,so that the calculated roots will always be real.

7.40 Write a complete C program that will calculate the real roots of the quadratic equation
&+bx+c=O
using the quadratic formula, as described in the previous problem. Read the coefficients a, b and c in the main
portion of the program. Then access the function written for the preceding problem in order to obtain the desired
solution. Finally, display the values of the coefficients, followed by the calculated values of x1 and x2. Be sure
that all of the output is clearly labeled.
Test the program using the following data:
-U -b -C
2 6 1
3 3 0
1 3 1
7.41 Modify the function written for Prob. 7.39 so that all roots of the quadratic equation
a?+bx+c=O
will be
0
Expert's answer

Answer in progress...

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS