help how to write code

May 23, 2013 at 3:31am
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
May 23, 2013 at 3:47am
Well... You know, there's a cpp book right there...
May 23, 2013 at 4:05am
closed account (4jzvC542)
@Daleth
which book you r talking about
can you tell me the code to solve it
May 23, 2013 at 4:05am
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?
May 23, 2013 at 5:04am
// For the positive root, try
double root1 = (-b + sqrt(b*b - 4*a*c))/(2*a);
May 23, 2013 at 6:25am
Grab any first-course C++ text, the first few chapters will show you how to tackle this pretty basic problem. Good luck
May 23, 2013 at 10:23am
Good.... i impressed.....
Topic archived. No new replies allowed.