Solving a quadratic equation

Hi guys.

I am meant to write the a program according to the requirements but unfortunately I am stuck. I was wondering If anyone could help me with the following problem.

Write a program to solve a quadratic equation which has the form , where
represents an unknown, and , and are the coefficients that can take any real values. The program will ask the user to enter the values of , and and then print out the solution. The program should include a function called solveQuad that should  handle any , and values entered by a user and respond ppropriately. For example, for some set of , and , there could be an infinite number of solutions. And for some set of , and , there could be no (real-valued) solution;  set a default argument for the coefficient only and the default value is zero.

Quadratic formula basic setup is
x = (-b +- sqrt(b^2 - 4ac)) / 2a

Quadratic equation is
y = ax^2 + bx + c


You're gonna need three numeric variables, preferably float. And a function that take three numeric parameters, such that:
float solveQuadratic( float a, float b, float c );

You're also going to need another function that tests for your discriminant (b^2 - 4ac) since, in your case, if the discriminant is negative, there won't be a solution.
Topic archived. No new replies allowed.