Question: CPE 2073 Homework 6 Objective Practice if...else statements. Background In homework assignments we evaluated quadratic equations, that is, we calculated y = ax? + bx

 CPE 2073 Homework 6 Objective Practice if...else statements. Background In homework
assignments we evaluated quadratic equations, that is, we calculated y = ax?

CPE 2073 Homework 6 Objective Practice if...else statements. Background In homework assignments we evaluated quadratic equations, that is, we calculated y = ax? + bx + c. for given values of x, a, b, and c. In this homework, we solve quadratic equations, which means that we find the roots of the equation, or in other words we find x where ax? + bx + c = 0, for given values of a, b, and c. Recall the quadratic formula: -btvb2 - 4ac 2a The expression under the square root (the quantity b2 - 4ac) is called the discriminant. If it is positive, there are two real roots; if it is zero, there is one real root; and if it is negative, there are two complex roots. Assignment 1. Write a function that solves a quadratic equation, given values of a, b, and c. The function should return void and take parameters a, b, and c, which are all doubles. Your function should print the root(s) of the equation with two decimal places in a way similar to the following example (obviously substituting the correct values for xl and 2). To do this, you'll need to test the discriminant for being positive, negative, or zero. if the discriminant is negative, don't forget to change its sign before calling the sart() math library function. Make sure you have in chath.h> in the header block X1 = 0.33 and X2 -1.00 (if there are two real roots) X100 (if there is one real root) x1 = 0.33 0.47 and X2 -0.33 -0.47 (if there are two complex roots) You can use either or as the imaginary unit, le 1. In electrical and computer engineering is often used instead of to avoid confusion where is used as a symbol for current.) 2. In main(), call your function to solve the following equations: a. 3x2 + 2x + 1 = 0 b. 5x2 + 2x - 7 = 0 c. x2 + 2x + 1 = 0 d. -x2 + 4x + 2 = 0 e. x2 2x + 4 = 0 f. 2x2 + 2x = 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!