Hey everyone,
I have a question on one of my homework problems. I'm in basic structured programming; C++.
The question states the following:
The root of the quadratic equation ax^2 + bx + c = 0, a ≠ 0 are given by the following formula:
-b +/- √b^2 – 4ac
2a
In this formula, the term b^2 – 4ac = 0, then the equation has a single (repeated) root. If b^2 – 4ac > 0, the equation has two real roots. If b^2 – 4ac < 0, the equation has two complex roots. Write a program that prompts the user to input the value of a (the coefficient of x^2), b (the coeeficient of x), and c (the constant term), and outputs the type of roots of the equation. Furthermore, if b^2 – 4ac >= 0, the program should output the roots of the quadratic equation.
(Hint: Use the function pow from the header file cmath to calculate the square root.)
**********************************************
I would post my starting point but it's basically just my header files and void main()
The only header files we've learned so far are iostream, iomanip, cmath, fstream and this problem is out of the control structures chapter.
Thanks for any help!!
:mrgreen: