Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ this one requires for the numbers to be solved using the quadratic equation. Please help: 1. Quadratic Equations The solution(s) to a quadratic equation
C++ this one requires for the numbers to be solved using the quadratic equation. Please help:
1. Quadratic Equations The solution(s) to a quadratic equation can be calculated using the Quadratic Formula: Program Requirements: Write a program that prompts the user to enter values for a,b, and c and display the results of two roots. Your program should define at least two functions, one for input and one for calculating the roots. Use the following function prototypes. // Return 1 if real roots exist. Otherwise, return 0. int quadratic(double a, double b, double c, double\& r1, double\& r2); quadratic function computes the two roots. The function has five parameters. The first three parameters are call-by-value parameters, and the last two are call-by-reference parameters. It returns 1 if real roots exist, otherwise return 0.r1 and r2 will return two real roots to the calling functions. void getInput(double\& a, double \&b, double\& c); //read three values and return back to the calling function Sample Output: Lab 8 Programming Exercise 1 by John Smith Quadratic Equation Program Please enter value for a: 3.5 Please enter value for b:1.0 Please enter value for c: 1.0 The equation has complex roots. Would you like to compute another quadratic equation? Y Please enter value for a: 2.0 Please enter value for b: 4.2 Please enter value for c:1.5 The two roots are -0.456283 and -1.64372 Would you like to compute another quadratic equation? NStep 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