How do i define this formula
X= B + (B^2 +4AC)^1/2 /2
This is a discussion on a beginner question within the C Programming forums, part of the General Programming Boards category; How do i define this formula X= B + (B^2 +4AC)^1/2 /2...
How do i define this formula
X= B + (B^2 +4AC)^1/2 /2
Didn't you just answer your own question? :d
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
Yeah, but I wonder if they meant to use xoring.Originally posted by Hammer
Didn't you just answer your own question? :d
Quzah.
Hope is the first step on the road to disappointment.
you mean X= (-B + (B^2 +4AC)^1/2 )/ 2Originally posted by xpflyer2002
How do i define this formula
X= B + (B^2 +4AC)^1/2 /2
and X= (-B - (B^2 +4AC)^1/2 )/ 2
hello, internet!
quit using the xor operator!! e.g. '^'
what you need is the POWER function, "pow(x, y)"
x = (-(b) + sqrt((double) (pow(b, 2) - (4*A*C)))) / (2*A)
x = (-(b) - sqrt((double) (pow(b, 2) - (4*A*C)))) / (2*A)
or you could use the power function and use .5 has the exp argument.
spoooooooooon_
yes ^ in C++ means XOR (Exclusive OR)
and as spoon wrote the right way on C++ but you need to add a nother header file which is cmath.h or math.h
^ means power in MATLAB but not in C or C++
>and as spoon wrote the right way on C++ but you need to add a nother header file which is cmath.h or math.h
Or <cmath>. But believe it or not, the expression was correct for C as well. Of course, in C you would have to include <math.h>.
My best code is written with the delete key.