Not sure how to start this c++ code, need some help. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Not sure how to start this c++ code, need some help.

Write the C++ statements that compute x1andx2 using 3 calls to predefined functions. x1 x2 are the quadratic equations -b - sqrt(b)^2 - 4ac/2 for x1 and -b + sqrt(b)^2 - 4ac/2 for x2. Some direction to start this would be very much appreciated, not sure what I am supposed to start with. Thanks

20th Mar 2021, 4:47 AM
Carlye
4 Answers
0
did you mean that you must solve equation: ax^2+bx+c = 0 ? you must first compute delta (b^2-4ac) if negative, no (real) solution if null x1 = x2 = -b/(2a) if positive x1 = (-b+sqrt(delta))/(2a) x2 = (-b-sqrt(delta))/(2a)
20th Mar 2021, 5:28 AM
visph
visph - avatar
0
I believe it's asking to compute the quadratic equation when entering numbers to compute the entered numbers in the equation by using calls in predefined functions.
20th Mar 2021, 5:38 AM
Carlye
0
your math doesn't make sense for me: sqrt(b)^2 == abs(b) but I don't know how to solve equation with abs(), and to solve an equation, you must provide an equality... anyway, you start to say "compute x1 and x2" and after you say "x1 and x2 are the quadratric equations... and you provide 2 mathematical expressions, but no equations (equations means expression equals something -- usually 0 or another expression) ^^
20th Mar 2021, 5:45 AM
visph
visph - avatar
- 1
I meant x1 and x2 is the quadratic equation but one is with - and the other is + to calculate with the neg and pos equation.
20th Mar 2021, 5:53 AM
Carlye