<so********@gmail.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
How do I write the quadratic equation in C++?
Thank You!
SonhadorPR
Quadradic Equation is
ax^2 + bx + c = 0 (where ^2 is squared).
For x this becomes:
-b +/- Sqrt( b^2 - 4ac )
x = ------------------------
2a
Which is known as the Quadratic Formula.
In C or C++ langauge terms this is:
x = (-b + sqrt( b*b - 4 * a * c ) ) / 2 * a;
x = (-b - sqrt( b*b - 4 * a * c ) ) / 2 * a;
(Yes, there are two possible answers.