Exponents

Mar 12, 2013 at 12:38am
In math, a number t times itself is t^2. Is it the same thing in C++?
Mar 12, 2013 at 12:40am
In C++, the ^ character represents a bitwise XOR operation, which is not the same as exponentiation. To raise to a power just multiply (e.g. t*t in your case) or use the pow() function.
Mar 12, 2013 at 12:42am
no use the pow function in the <cmath> header. http://www.cplusplus.com/reference/cmath/pow/
Topic archived. No new replies allowed.