cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
How to write this formula
How to write this formula
Mar 7, 2011 at 1:49am UTC
SOCIALISTICmeow
(14)
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);
Mar 7, 2011 at 1:53am UTC
hanst99
(2869)
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++).
Mar 7, 2011 at 3:55am UTC
SOCIALISTICmeow
(14)
Thanks(sorry about the vocabulary mix up), but your answer worked perfectly! Thank you very much :)
Topic archived. No new replies allowed.