I can't figure this out!

This is a discussion on I can't figure this out! within the C++ Programming forums, part of the General Programming Boards category; I cannot figure out how to write this equation into a program. P = Ar /( 1 - (1 + ...

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    16

    Angry I can't figure this out!

    I cannot figure out how to write this equation into a program.

    P = Ar /( 1 - (1 + r) to the negative n power)

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    156
    Try pow ( declaration in <math.h> ).

    pow
    Calculates x raised to the power of y.

    double pow( double x, double y );

    I think you code would look something like this.

    P = Ar / pow( ( 1 - ( 1 + r ) ), -n );
    Last edited by Dang; 09-19-2001 at 10:21 PM.

  3. #3
    Registered User
    Join Date
    Aug 2001
    Posts
    72
    Hi
    you know from math cources that X^-n is euqal to 1/X^n so try to use thet and rewrite your code usin the positive powers
    e.g.
    P = Ar /( 1 - 1/pow((1 + r),n)) where n is with the oposite sign from your original post

    damyan

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 3 dimensional figure volume
    By thekautz in forum C++ Programming
    Replies: 2
    Last Post: 01-20-2009, 04:22 PM
  2. Can't figure out why code is hanging up
    By Panserbjorn in forum C Programming
    Replies: 3
    Last Post: 10-28-2007, 05:09 PM
  3. trying to figure out someone's code for a plugin
    By paulpars in forum C++ Programming
    Replies: 4
    Last Post: 07-20-2006, 10:57 AM
  4. newb to C, cant figure something out.
    By Phate4219 in forum C Programming
    Replies: 16
    Last Post: 03-06-2006, 12:47 AM
  5. I can't figure out this compiler error
    By lime in forum C Programming
    Replies: 7
    Last Post: 07-25-2003, 05:09 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21