Question: Write a C++ program that calculates the quadratic formula It will take in three inputs: a, b, and c. It will return the roots of

Write a C++ program that calculates the quadratic formula

It will take in three inputs: a, b, and c. It will return the roots of the calculation. It will also have a function, haveImaginaryRoots, that will take in the inputs a, b, and c and return bool, using the formula: b2 4ac. If the result is < 0, it has imaginary roots. Otherwise, all the roots are real. If you get imaginary roots, you will have to add i' to the end. use the library for pow and sqrt

Here's a sample run:

Enter a: 1 Enter b: -3 Enter c: 2 The roots are 1 and 2. Do you want to continue (Y/N)? Y Enter a: 1 Enter b: 0 Enter c: 9 The roots are 3i and -3i. Do you want to continue (Y/N)? N

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!