C ++ 11 5.12 - Bitwise exclusive operator OR
exclusive or self-expression: and expression Exclusive expression or expression 1 Conventional arithmetic conversions are performed; the result is a bitwise exclusive OR operand function. The operator is applicable only to the integral or non-enumerated operands of an enumeration.
If you want to calculate v = (p) * (1 + r) n , you need to change
v=(p)*(1+r)^n;
to
v = p * powf(1+r, n); // powf: exponential math operator in C++
C++, ^ XOR ( ) , . a = 2 ^ 3; // a will be 1.
.