4*4*4*4=?
-
-
Hi I have a very little problem, but still it is a problem so please if you know any solution write me back. How do you write this 2^4 in C++? When I write it in the program the compiler, compiles it as 2+4=6 when it should be 2*2*2*2. thanks!
2^4 = 0010 ^ 0100 = 0110 = 6 which would explain why you are getting 6 as a result. I would suggest using the following function located in math.h double pow( double x, double y ); Sean Cody
-
Hi I have a very little problem, but still it is a problem so please if you know any solution write me back. How do you write this 2^4 in C++? When I write it in the program the compiler, compiles it as 2+4=6 when it should be 2*2*2*2. thanks!
-
Hi I have a very little problem, but still it is a problem so please if you know any solution write me back. How do you write this 2^4 in C++? When I write it in the program the compiler, compiles it as 2+4=6 when it should be 2*2*2*2. thanks!
^ is the XOR operator in C. :) As others have said there is no raise-to-power operator. --Mike-- "Everyone has figured out what 'service pack' really means, so they had to go and change the language. Perhaps this is what Bill was talking about in the 'security is top priority' letter." -- Daniel Ferguson, 1/31/2002 My really out-of-date homepage Sonork - 100.10414 AcidHelm Big fan of Alyson Hannigan.