Question: Project Goals: To write a C++ program that: Gets us started programming in C++ Utilizes the selection (if, if..else) construct. Program Description: Recall that the

Project Goals: To write a C++ program that: Gets us started programming in C++ Utilizes the selection (if, if..else) construct. Program Description: Recall that the quadratic formula, which is used to determine the roots of the general quadratic equation, is this: = Write a C++ program that will display to the user the number of real roots of the equation for different user-provided values of a, b, and c, and then computes and displays the real roots (if there are no real roots, the program should say so). 1. Prompt the user for three values: a, b, and c. The format of the prompt is as follows: Please enter an integer value for a: -> Please enter an integer value for b: -> Please enter an integer value for c: -> Remember that the user will press after inputting their values, which will drop the cursor to the next line! 2. Compute the value of the discriminant and use the result to determine how many roots exist and display that information to the user. NOTE: the discriminant of the quadratic equation is the value of the arithmetic expression under the radical Also, the value of the discriminant determines the number of real roots as follows: Discriminant is positive Two real roots Discriminant is zero One real root Discriminant is negative No real roots You must use the arithmetic operator for multiplication and the assignment operator to store the computed value into a variable. Once you have computed this value, display the number of roots you will compute to the user. 3. Compute and display the real roots of the equation. If no real roots exist, display a message that says so. An important note: You may be wondering: How are we going to compute a square root? We will have to get ahead of ourselves a little and use what is called a function from the library. We will learn about functions in chapter 3, but for now, know that we can use the sqrt() function from the math library to compute the square root for us! At the top of your program, include the math library: #include Later in your program you can do this: double discriminant = ... (1) double root = sqrt(discriminant); (2) If discriminant were assigned 25 when its value was computed at (1), then root will have the value 5 after (2) executes! Specifications: 1. The program must display clear, explicit prompts for the user. 2. The program must display clear, understandable statements for all output

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!