I trying to write this code for the quadratic equation. These are the instructions
�dEnhance the Quadratic program in the following manner. If the roots are not complex, Enhance the Quadratic program in the following manner. If the roots are not complex, compute the two roots of the quadratic equation using the formula:
x= -b + or - sqrt of d / 2a
Once the two roots are calculated, display them to the screen with a descriptive message. Note: At this point you should go back and change the PURPOSE comment at the top of the file – you have significantly changed what this program does!
/////////////////////////////////////////////////////////////////////////////
//
// Name: Quadratic.cpp
// Author: Jeffrey A. Stone
// Course: CMPSC 101/121
// Purpose: Prompts the user for the three coefficients of a quadratic
// equation, and determines if the user has entered sufficient
// values to represent a quadratic equation.
//
/////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <iomanip>
#include <cmath>
usingnamespace std;
/////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: main
// PARAMETERS: None
// RETURN TYPE: int
// PURPOSE: Entry point for the application.
//
/////////////////////////////////////////////////////////////////////////////
int main()
{
double a = 0.0, b = 0.0, c = 0.0; // stores the coefficients
// prompt the user to enter three coefficients, separated by spaces...
cout << "Please enter the coefficients, separated by spaces: ";
cin >> a >> b >> c; // input the three values
// echo-print the input...
cout << endl
<< "You entered a = " << a << ", b = " << b
<< ", c = " << c << "." << endl;
if ( a == 0 )
{
// not a quadratic equation, display an error message...
cout << "ERROR: the first coefficient must not be zero." << endl;
}
else
{
// a valid quadratic equation, display an error message...
cout << "The coefficients are valid." << endl;
}
// exit the program with success (0 == success)
return 0;
}
I AM VERY NEW TO THE LANGUAGE. NOT ASKING TO SOLVE JUST TO EXPLAIN