Shana S.

asked • 03/25/21

I need to solve this answer but don't know where to start

Given the above information, write a string function named RootDistance() that takes three double parameters that represent the coefficients of a quadratic function in descending order (a, b and c in that order). If the quadratic function has at least one real root, the function returns the distance between the roots as a string; otherwise, the function returns the string 'no roots'. Use the functions sqrt () from the Cmath library and to string() from the string library to calculate the square root and convert a double to a string respectively. For instance, the calls RootDistance(1,-6,9), Root Distance(10,-1,-2) and RootDistance(1,0,1) will return '0', '0.9' and 'no roots' respectively. 

1 Expert Answer

By:

Patrick B. answered • 03/26/21

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.