How to write this formula

Im trying to make a program using the compound intrest formula. The formula is

A = P(1+(r/n)^nt

how would i write this out in code, because my compiler is not excepting what i wrote down.

a = p * (1.0 + (r / n)) ^ (n * t);
accepting, not excepting.

^ is the bitwise XOR operator in C++. For what you want to do, you would have to use the pow function from math.h / cmath (math.h in C and cmath in C++).
Thanks(sorry about the vocabulary mix up), but your answer worked perfectly! Thank you very much :)
Topic archived. No new replies allowed.