PLEASE HELP WITH C++!!!!! Design an algorithmic solution for determining whether
ID: 3827285 • Letter: P
Question
PLEASE HELP WITH C++!!!!!
Design an algorithmic solution for determining whether the roots of a given quadratic are real or complex. Implement your solution in three ways. First, implement your solution with "if" statements. Second, implement your solution with
"if-else" statements. Third, implement your solution with "switch" statements. (Hint: for switch statements, use an indicator variable.)
Once you have done this, use cout and cin to interface with a user to input three coefficients (a,b, and c) of quadratic. Then, provide to the user the results after using each of the three methods.
EXTRA CHALLENGE: Provide the user with the value of the roots (values of x).
Explanation / Answer
I am implementing the solution with "if-else" statements. #include #include using namespace std; int main() { float a, b, c, x1, x2, determinant, realPart, imaginaryPart; cout > a >> b >> c; determinant = b*b - 4*a*c; if (determinant > 0) { x1 = (-b + sqrt(determinant)) / (2*a); x2 = (-b - sqrt(determinant)) / (2*a); coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.