Question: In C + + . Make a quadratic equation solver using this template. And explain each step This is a program to give the solutions

In C++. Make a quadratic equation solver using this template. And explain each step
This is a program to give the solutions to a quadratic equation.
The user will enter the three coefficients of the equation.
Let's call them a, b, c. So the equation is ax^2+ bx + c =0
By the quadratic formula the solutions are
x1=-b + sqrt(b^2-4ac) all divided by 2a.
x2=-b - sqrt(b^2-4ac) all divided by 2a.
Note: In the C++ code we need to be very careful about
the order in which arithmetic operations are performed.
For the output we'll round to three digits after the decimal point
and we'll place the result in a "column" as shown below
x1=45.567
x2=1234.200
*/
#include
using namespace std;
int main()// This is a single line comment
{
double a, b, c, x1, x2, discriminant;
// prompt the user for three coefficients
// input statement for a, b and c.
// Set discriminant to b squared minus 4 times ac.
// Two more assignment statements...
// First assignment statement gives x1 a value.
// Second assignment statement gives x2 a value.
// Output the result to the console e.g.
// x1=45.676
// x2=3456.200
// NOTICE: The outputs are formated using setw
// and the number of digits after the decimal point
// is 3.
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!