Please help. My results are wayyyy off. If you put in 10 for the rate and 36 for the period... it's waaayyy off. I feel like I'm looking right at it and just dont see the issue. many many many thanks.
#include <iostream>
#include <cmath>
#include "COMPFUN.H"
using namespace std;
The values are OK if you are working for the mob. You have a rate of 1000% per month. If you want to input the annual percentage use
result = presentValue * pow(( rate*0.01 + 1), n/12);
Also, try not to use global variables (presentValue). Better to declare it in the main function, otherwise in future value function is not clear that you use the global presentValue, or the presentValue that you pass to the function
hi, i have one question for you mr.Garrett05:
aren't you have an "out of range" problem in the futurevalue() ??
i made some calculations and i happened to find that you're trying to store a really large number in the "result" variable:
the value of pow((rate+1),n) is like 11^36 , and a double can only store a 64bit number, so with some calculations you find that 11^36>x>2^64.
that's bigger than double can handle, i wonder!!!.