# C++ program trouble

• 03-15-2002
senrab
C++ program trouble
Hi,
I am a beginning student of C++ and I am having trouble with the whole programming process. Here's, my latest trouble I am now writing a program to calculate mortgage payment with interest rates from 6% to 10%, starting at 5 years to 30 years with 5 year increments. Formula: m = r*l*f / 12 *f / 12* (f - 1); where f = (1 + r/12) * 12*y.
Here is a sample of my code:

float r; //variable for interest rate
int l; //variable for loan amount
int y; //variable for the number of years
float mgt; //mortgage
int pow;
float f = pow((1 + r/12),(12 *y));
float f1 = pow((1 + r/12),(12*y-1));

for (r = .06; r <=.10; r++)
{
for(y = 5; y <=30; y++)

my trouble is when I compile and run my program I keeping get an error message relating to pow-term does not evaluate to a function. What does this mean?
• 03-15-2002
salvelinus
Re: C++ program trouble
Quote:

Originally posted by senrab
my trouble is when I compile and run my program I keeping get an error message relating to pow-term does not evaluate to a function. What does this mean?
Did you #include [itex] in your program?
• 03-15-2002
Betazep
>>>int pow;

take that out.

put this in...

#include<cmath>
using namespace std;

+++++

for (r = .06; r <=.10; r++)

increment adds a whole integer 1. How is this going to work?
• 03-15-2002
Govtcheez
WTF? How has this thread been up for 20 minutes and already have 1500 views?
• 04-27-2003
testhis
int pow; ?????
pow is a function in math.h
• 04-27-2003
Jamsan
few things....first, pow is a function, don't need to initialize it....just include the math.h library...second, for your for loop, your going to have to do an r+=.01 instead of r++....each time the loop operates, itll had 1.0, not .01 like you want it to.
• 04-27-2003
confuted
Quote:

Originally posted by Govtcheez
WTF? How has this thread been up for 20 minutes and already have 1500 views?
Looks like someone was bored and went crazy with the refresh button
• 04-29-2003
ektrem^gal
can anybody help me
you must include math..

can anybody help me in my programming???