In math, a number t times itself is t^2. Is it the same thing in C++?
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.
no use the pow function in the <cmath> header. http://www.cplusplus.com/reference/cmath/pow/
Topic archived. No new replies allowed.