-
non security c++ help
If all else is correct, libraries, variables etc., what is wrong with the following future value formula:
(payment*((1+rate)pow-1))/rate
I have a paper do tomorrow and complie as I go along and, using visual studio6, all errors point to the formula-I have fiddled with it for an hour and it's in the book-any ideas???
#include <iostream>
#include <cmath>
#include <fstream>
using namespace std;
int main()
int payment = 0;
int term = 0;
float rate = 0.0;
float value = 0.0;
/* the cins and couts are enter and every "term" has a cin excepting value which will be defined as the future value of a deposit plan compounded annually and the floats and ints are right for the info i have to enter- the error says something to the effect that the parentheses before "pow" isn't defined*/-the readers digest version
-
What kind of error are you getting?
What's the type of those variables?
Ammo
You can't just put pow after the parenthesis as in the mathematical format, you need to the multplicaiton symbol *...
Ammo
-
As ammo said, the pow function has to be used as
pow(base, exponent)
Assuming I have the future value formula correct (I used FV = Payement*((1+rate)^numYears)
you would have
FV = payement*(pow(1+rate, numYears))
Hope this helps!
-
Oh! Heh, I thought pow was also a variable!
Disregard my answer, Algaen's right!
Ammo