Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ Write a clear code for this assignment and attach the code please its C++ Here are examples of a user's interaction with the program
C++
4. Recall that a quadratic equation is one of the form ax2+bx+c=0, where the coefficients a,b, and c are real numbers and a=0. The solutions to a quadratic equation can found using the quadratic formula: x=2abb24ac Write a program that will prompt for and read the values of the coefficients a,b, and c, and then calculate and display the solutions of the quadratic equation having those coefficients. Program requirements: a) Use floating point variables to hold the values of a,b, and c. b) Your program should generate an error message and force reentry if the user enters a value of zero for a. c) Your program should work whether the quadratic equation has two real number roots, one real number root, or two complex number roots. d) The function sqrt should be used to calculate the needed square root. To find the square root of a variable x, include this code: sqxt (x) Note: To use this function, you need to add \#include cmath> after the other include statement at the beginning of your code. To find the square root of a variable x, include this code: sqrt (x) Here are examples of a user's interaction with the program: Run 1: Quadratic equation solver: Enter a: 0 a cannot be zero - reenter Enter a: 1 Enter b: 3 Enter c: 2 There are two real solutions: 1 and 2 Run 2: Quadratic equation solver: Enter a: 1 Enter b:6 Enter c: 9 There is one real solution: 3 Run 3: Quadratic equation solver: Enter a: 1 Enter b: 2 Enter c: 10 There are two complex solutions: 1+3i and 13i Write a clear code for this assignment and attach the code please its C++
Here are examples of a user's interaction with the program
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started