Question: Problem: Construct and run a C++ program to find the roots, if any, of the following equation Ax? + Bx + C = 0 given

 Problem: Construct and run a C++ program to find the roots,

Problem: Construct and run a C++ program to find the roots, if any, of the following equation Ax? + Bx + C = 0 given the coefficients of A, B and C. Use the quadratic formula to calculate the roots. -b+Vb2 - 4ac 2a where b2 - 4ac is the discriminant. Algorithm: Declaration of variables Input coefficients A, B, C Calculate the discriminant (disc) If the discriminant is greater than zero Calculate rootl: (-b+sqrt(disc))/(2a) Calculate root2: (-b - sqrt(disc))/(2a) Output root1 Output root2 Otherwise, if the discriminant is equal to zero Calculate root:-b/(2a) Output root Otherwise, if the discriminant is less than zero Output message that there are no roots Suggested screen design: Input coefficients for a, b and c: 1.0 5.0 6.0 Root1: -2.00 Root2: -3.00 Press any key to continue Input coefficients for a, b and c: 1.0 4.0 4.0 Root: -2.00 Press any key to continue Input coefficients for a, b and c: 4.0 1.0 2.0 There are no roots. Press any key to continue

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!