Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Quadratic Equations Given a quadratic equation in standard form, , solutions for x can be determined using the quadratic formula, . The values of x

Quadratic Equations

Given a quadratic equation in standard form, , solutions for x can be determined using the quadratic formula, . The values of x can be real or complex. The discriminant, , is used to determine the nature of the root(s). If the discriminant is negative, there will be no real roots. If the discriminant is 0, there will be one real root. In the third case, a positive discriminant will yield two real roots. (Real roots are of particular interest in solving physical world problems.)

Write a function that will determine the number of real roots for a quadratic equation as well as calculate any real roots. The function prototype should be:

Code Illustration
int calcQuadraticRoots(double a, double b, double c, double& x1, double& x2); 

where a, b, and c represent the coefficients from the standard form of the quadratic equation and x1 and x2 represent the possible real roots.

If the number of real roots is zero, the function should return 0 without assigning values to x1 and x2. If the number of real roots is one, the function should assign the value of the real root to x1 and return 1. If the number of real roots is two, the function should assign the larger value to x1 and the smalle value to x2 and return 2.

Include driver code in function main() to test this function thoroughly. Your driver code should display the values of the coeffients of the quadratic equation, the number of roots of the quadratic equation as well as the roots of the quadratic equation.

I am learning C++ right now.

I am learning parameter, void.

Thank you for your helping!

Your program should not prompt the user to enter any information.

Although not required by this assignment, any additional functions you create would help to demonstrate your grasp of the concepts of top-down design and modular coding.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

1st Edition

1597496251, 978-1597496254

More Books

Students also viewed these Databases questions

Question

Use source transformation to find Io in the circuit shown 12 Io 2mA

Answered: 1 week ago

Question

=+employee to take on the international assignment?

Answered: 1 week ago

Question

=+differences in home- and host-country costs of living?

Answered: 1 week ago