Hi

I'm trying to write a simple console program to find the real roots of a quadratic equation. It's part of self-study. I have a rough idea which you can have a look on below. Please help me to finish it and correct the errors. I'm highly grateful for your guidance and help. Thanks a lot.

I hope this general pseudocode is correct:

Here is my 'rough' and full of errors incomplete implementation:Code:Read the coefficients “a” and “b”, and constant “c” of ax^2 + bx + c = 0 Let Discriminant D = b^2 - 4ac IF D >= 0 THEN Real root R1 = (-b + sqrt(D))/(2a) Real root R2 = (-b - sqrt(D))/(2a) ELSE Print “no real solutions” ENDIF Print R1 and R2 Stop

Code:#include <iostream> using namespace std; int main () { float a, b, c, R1, R2 //variables and constants used; cout<< "Enter a, b, c of the equation ax^2+bx+c==0="; cout<< "Enter a="; cin>> a; cout<< "Enter b="; cin>> b; cout<< "Enter c=" cin>> c; D = b^2 - 4ac; if (D>=0) { R1 = (-b + sqrt(D))/(2a) R2 = (-b - sqrt(D))/(2a) else no real roots exist }