help how to write code

closed account (4jzvC542)
i have given following exercise in my cpp book:

Determine the roots of quadratic equations

ax^2 + bx + c = 0

using formula

x = -b +(plus-minus) (root)b^2 - 4ac/2a

i don't now how to write such code
can any one help me please
thanking you
parjanya
Well... You know, there's a cpp book right there...
closed account (4jzvC542)
@Daleth
which book you r talking about
can you tell me the code to solve it
Think about it. It gives you the formula, and what is put into the formula... now what do you do in code that involves plugging values in?
// For the positive root, try
double root1 = (-b + sqrt(b*b - 4*a*c))/(2*a);
Grab any first-course C++ text, the first few chapters will show you how to tackle this pretty basic problem. Good luck
Good.... i impressed.....
Topic archived. No new replies allowed.