Question
The standard form of a univariate polynomial of second degree is () = 2 + + In user.cpp file 1. Write a function to read
The standard form of a univariate polynomial of second degree is () = 2 + +
In user.cpp file 1. Write a function to read the values a, b, and c from standard input (with cin) 2. Write a function to output the quadratic equation to standard output (with cout): For instance, if the coefficient is 0, do not print 0 in 0*x^3 ; however, make sure that the zero polynomial is printed. You could write a separate function to output the coefficients but you dont have to. 3. Write a function to display the results to standard output (with cout) 4. In the main function, call the various functions and ask the user whether to continue by reading new a, b, and c and then solving the quadratic equation or whether to stop.
In quadratic.cpp file 1. Write a function calculateRoots to return the number of real roots in the quadratic equation and the (possible) calculated roots.
int calculateRoots( a, b, c, root1, root2) {
}
2. The data types in calculateRoots right now are missing: the code does not compile.
3. There should be a single function calculateRoots to both return the number of roots and to computer the real roots (pass the arguments for the roots by reference). 4. Do not do any input nor output in calculateRoots.
The rules for finding the real roots of a quadratic equation: 1. If b24ac, then there are two real roots: x=2ab+b24acx=2abb24acStep 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