Question: Define and test a function called isQuadratic that finds the solutions of a quadratic equation: ax^2 + bx + c = 0 Make it a

Define and test a function called isQuadratic that finds the solutions of a quadratic equation:

ax^2 + bx + c = 0

Make it a Boolean function that returns true if real solutions exist and false otherwise. Pass the coefficients a, b, and c by value. Place the calculated solutions into two variables passed to the function by reference.

Recall that the formulas for the solutions of a quadratic equation are:

x1 = -b + sqrt(b^2 - 4ac) / 2a

x2 = -b - sqrt(b^2 - 4ac) / 2a

a. You will need to use the sqrt(double z) standard library function for calculating the square root. It is declared in math.h.

b. Your code must get a, b, and c as input.

c. If x1 and x2 are real numbers print them to the output screen

d. If x1 and x2 are not real numbers print "Calculated numbers x1 and x2 are not real numbers. They are imaginary!"

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!