| dagreat45 (12) | |
|
This is a big one and I don't understand Write a C++ function named quadratic which has parameters a,b, and c of type int which calculates only double? Write a C++ function named quadratic which has parameters a,b, and c of type int which calculates only double real roots of quadratic equations according to the formula: r1=-b+Sqrt(b^2-4ac)/(2a)), r2=-b- Sqrt(b^2-4ac)/(2a)) The two real roots are passed back to the caller via two parameters r1 and r2 of type float. When quadratic cannot calculate two real roots, it prints out the appropriate error message and returns -1 to the caller as a warning not to use the values of the roots. When it can calculate two real solutions, it returns 1 to the caller to indicate success. | |
|
|
|
| kbw (5371) | |
| You can start by writing the signature of the function, then we can look at filling it in. | |
|
|
|