Thread: C++ program trouble

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    1

    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?

  2. #2
    Registered User
    Join Date
    Jan 2002
    Posts
    559

    Re: C++ program trouble

    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 <math> in your program?

  3. #3
    _B-L-U-E_ Betazep's Avatar
    Join Date
    Aug 2001
    Posts
    1,412
    >>>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?
    Blue

  4. #4
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    WTF? How has this thread been up for 20 minutes and already have 1500 views?

  5. #5
    Registered User
    Join Date
    Apr 2003
    Posts
    1
    int pow; ?????
    pow is a function in math.h

  6. #6
    Registered User
    Join Date
    Feb 2003
    Posts
    162
    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.

  7. #7
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    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
    Away.

  8. #8
    Registered User
    Join Date
    Apr 2003
    Posts
    2

    can anybody help me

    you must include math..


    can anybody help me in my programming???

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Having a bit of trouble with a binary search program
    By d-dub in forum C++ Programming
    Replies: 2
    Last Post: 04-11-2006, 05:20 AM
  2. Need help with my program...
    By Noah in forum C Programming
    Replies: 2
    Last Post: 03-11-2006, 07:49 PM
  3. I need some help with my program please.
    By agentxx04 in forum C Programming
    Replies: 9
    Last Post: 09-26-2004, 07:51 AM
  4. Replies: 2
    Last Post: 05-10-2002, 04:16 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM