Future value question

I am new to C++ and worked hours on this today. I need to calculate the future value. Can anyone check this out and see what I am doing wrong? For some reason my pow will not light up so I am not being sure it is being recognized. Any help is greatly appreciated. Thanks!

#include <iostream>
#include <cmath>
using namespace std;

int main()
{
//Payment
cout << " Enter payment amount: ";
double payment;
cin >> payment;

//ENTER INTEREST RATE
cout << " Enter an interest rate: ";
double rate;
cin >> rate;

//ENTER PERIODS
cout << "Enter number of payment periods: ";
double periods;
cin >> periods;

//CALCULATE

double futurevalue = payment * pow(1 + rate / periods, - 1 / periods);

//DISPLAY RESULTS
cout << "Your future value is: " << futurevalue << endl;

return 0;
}
Edit
Report
Delete
What's the problem, exactly?
Unless your IDE highlights every single defined thing, pow shouldn't 'light up'.

What's wrong anyway? Are you getting a compiler error? If so then what is it?
It is compiling fine, but my future value answer is way off. I'm sure it is a equation problem but I do not see what it could be. The exact equation is futurevalue=payment*((1+rate)^periods)-1/periods

should my pow function be pow(periods / 1+ rate) since pow(a,b) computes 'a' raised to the power of 'b?'
Well, your program is calculating:

payment * {[1 + (rate/periods)]^(-1/periods)}


which is different than what you want:

payment*((1+rate)^periods)-1/periods
payment * pow((1 + rate), periods) - 1 / periods

Does this look better, incorporating the pow function?
thanks
Yes it looks better. But I'm not sure you want to subtract 1/periods at the end.

Maybe you wanted to multiply?

payment * pow((1 + rate), periods) * (-1/periods)
Ok, thanks a ton. I am about to run it and see how it runs.
its running 1 error and 2 warnings now

cpp(1) : warning C4627: '#include <iostream>': skipped when looking for precompiled header use
Add directive to 'stdafx.h' or rebuild precompiled header

cpp(2) : warning C4627: '#include <cmath>': skipped when looking for precompiled header use
Add directive to 'stdafx.h' or rebuild precompiled header

cpp(31) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
I think one thread is plenty:
http://www.cplusplus.com/forum/beginner/44964/
Topic archived. No new replies allowed.