Question: Code this using c++ for a quadratic equation solver: The requirements for our solver were updated. We now have to solve the linear solution that

Code this using c++ for a quadratic equation solver:

The requirements for our solver were updated. We now have to solve the linear solution that can result when a=0, and we have to output imaginary roots as well!

Requirements

Do not use the complex number class.

The program should give all roots including imaginary ones.

If the coefficients constitute a linear equation you should calculate the single root.

Input:

Three coefficients (a, b, and c respectively) on a single line separated by spaces.

Output:

The equation being solved. See Sample Run below for format.

Roots.

Each root on a separate line.

If there is more than one root, then the one obtained by subtraction is first.

Roots should be reported as

x =

x = - i

x = + i

Note that there is a single space ( ) on either side of an '=', a '+' or a '-'.

If no valid solutions can be calculated, then output: Unable to determine root(s).

Note that endl puts a line return () at the end.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!