Reference no: EM132196709
Write a C++ program to solve a single quadratic equation of the form: a*x2 + b*x + c = 0 with the following specific requirements:
1) Reading of coefficients a, b, c shall be done by calling a function named readCoeffs(), once for each coefficient. They shall be entered as double's from the keyboard by an operator, after prompt, as follows: Enter coefficient: and returned to the caller, one at a time, as a single double. Variables' names must be as indicated, a, b, and c, declared locally (not globally).
2) The actual solution of the equation shall be done by a function named equSolver(), which takes three coefficients, a, b and c, as parameters and returns a boolean indicator (declared locally, not globally), whether the roots do exist, and in case they do, places them in global variables named root1 and root2.
3) The function equSolver() shall call another function named discr() to calculate and return the discriminant necessary to compute the roots.
4) After the equation is solved, another function named outResults() shall display on the screen results of the calculation in the following format:
a) If the solutions (roots) exist in the real domain, the output shall look exactly as follows: Quadratic equation with the following coefficients: a: ; b: ; c: has the following roots Root1: ; Root2: ;
b) In case there are no solutions (roots) in the real domain, the output shall look as follows: Quadratic equation with the following coefficients: a: ; b: ; c: has no roots in the real domain.