error: invalid operands of types "double" and "int" to binary "operator^"
error: invalid operands of types "double" and "int" to binary "operator^"
error: "sqrt" was not declared in this scope
^ is the xor bitwise operator. (Not what you want here.)
It takes two int's as operands so that's why you were getting that error.
Even if a had been an int you would not have gotten the correct answer.