2.24 Lab02: Solving Quadratic Equations Write a complete C++ program that inputs
ID: 3743648 • Letter: 2
Question
2.24 Lab02: Solving Quadratic Equations Write a complete C++ program that inputs 3 real numbers denoting the coefficients a, b and c for the quadratic equation ax*2+ bx +c-o solves for x, and outputs the real root solution(s) For example, given the input 1.0 3.3 2.0 Your program should output the 2 real roots followed by a newline (C+t endl) -0.8, -2.5 If the discriminant is 0.0, then there is only one real root, and your program should output exactly ode value. For example, given the inpur 2.0 4.0 2.0 Your program should output real root: -1 Finally, if the discriminant is negative, then there are no real roots, and your program should say so. For example, given the input 1.0 2.0 3.0 Your program should output no real rootsExplanation / Answer
#include #include using namespace std; int main() { double a, b, c; cin >> a >> b >> c; double d = (b*b - 4*a*c); if(d == 0) { coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.