non security c++ help
Results 1 to 4 of 4

Thread: non security c++ help

  1. #1
    Senior Member
    Join Date
    Jan 2003
    Posts
    242

    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
    the only way to fix it is to flush it all away-tool

  2. #2
    Senior Member
    Join Date
    Sep 2001
    Posts
    1,027
    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
    Credit travels up, blame travels down -- The Boss

  3. #3
    Senior Member
    Join Date
    Nov 2002
    Posts
    186
    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!
    \"When you say best friends, it means friends forever\" Brand New
    \"Best friends means I pulled the trigger
    Best friends means you get what you deserve\" Taking Back Sunday
    Visit alastairgrant.ca

  4. #4
    Senior Member
    Join Date
    Sep 2001
    Posts
    1,027
    Oh! Heh, I thought pow was also a variable!
    Disregard my answer, Algaen's right!

    Ammo
    Credit travels up, blame travels down -- The Boss

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •