So far i have been able to successfully output the first three that are asked for, shown in copied and pasted problem below, but when i input 0, 8 , -12 i get the output.

nan

-inf

I'm utterly unsure why i would get this kind of output, but i'm assuming it's an obvious indicator that the last section of my code is where the error, or errors, are. I'm certainly not asking for anyone to complete my assignment, as i have about half of it left, but any help on any of my code to point me in the right direction would be very much appreciated.

__________________________________________________ ____________

The question:

__________________________________________________ _________________

The solution of the equation ax2 + bx + c has 6 cases, that can occur with various values of a, b, and c.

Test for these 6 cases in the order given here.

Do not compute any values until you have determined what calculations are needed.

The 6 cases are:

- When a, b, and c are all zero, any value of x is a solution. Print: Any value of x is a solution.
- When a and b are zero and c is not, no solution exists. Print: No solution exists.
- When a is zero and b is not zero, the only solution is x = -c/b. Calculate the value of x and print the solution.

The remaining three cases are determined by the value of the determinant.

The determinant is b2 - 4ac.

Compute and save the value of the dererminant now.

You can use the value of the determinant you saved to select one of the remaining three cases.- When the determinant is zero, the only solution is x = -b/2a. Calculate the value of x and print the solution.
- When the determinant is positive, two solutions are given by the following two expressions:

x1 = ( -b + √b2 - 4ac ) / 2a

x2 = ( -b - √b2 - 4ac ) / 2a

Print both solutions.- When the determinant is negative, the solutions have an imaginary component. Print: The solutions have an imaginary component.

If you are fimiliar with imaginary numbers, you may compute and print the result, but this is not required.

Test it 7 times:

- a = 0 b = 0 c = 0
- a = 0 b = 0 c = 4
- a = 0 b = 8 c = -12
- a = 2 b = 4 c = 2
- a = 2 b = 2 c = 0
- a = 100 b=100 c= -11
- a = 1 b = 1 c = 1

Check your results by hand, by substituting your results back into the equation and verify that they are roots.

__________________________________________________ _______

my code:

__________________________________________________ __________

Code:#include <cmath> #include <iostream> #include <iomanip> using namespace std; int main() { double a; double b; double c; double determinant = pow(b, 2) - (4 * a *c); double x3 = -c / b; double x4; double x5; double x5a; // Established the variables a, b, and c. // Also established determinant. // Established x outputs as x4 for the fourth situation, hence x4. // x5 and x5a are defined for the to potential solutions for situation 5, // hence 5 and 5a. cout << "please enter value for a: "; cin >> a; cout << "please enter a value for b: "; cin >> b; cout << "please enter c value: "; cin >> c; if (a == 0 && b == 0){ // if a, b, and c = 0 any x is correct. if (c == 0) cout << "any x value is correct" << endl; } if (a == 0 && b == 0 && c != 0) { // if a and b are zero and c isn't, no solution cout << "invalid, no solution" << endl; } determinant = pow(b, 2) - (4 * a *c); if (determinant == 0 && a != 0){ x4 = -b / (2 * a); cout << x4 << endl; } if (determinant > 0){ x5 = (-b + sqrt(pow(b,2)- (4*a*c))) / (2 * a); x5a = (-b - sqrt(pow(b,2)- (4*a*c))) / (2 * a); cout << x5 << endl; cout << x5a << endl; } }