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.