Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Math function help

Math function help

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Binary0110
    wrote on last edited by
    #1

    Can someone help me turn this into c++ code. I thought I had it but I keep getting errors. What am I doing wrong? N is an exponent. Payment = Rate * (1 + Rate)N -------------------- * L ((1 + Rate)N – 1) Here is my code: double payment=(mrate*(1+mrate)* exp (n)/((1+mrate)* exp(n)-1))*l; BINARY -- modified at 3:22 Monday 31st October, 2005

    R A D 3 Replies Last reply
    0
    • B Binary0110

      Can someone help me turn this into c++ code. I thought I had it but I keep getting errors. What am I doing wrong? N is an exponent. Payment = Rate * (1 + Rate)N -------------------- * L ((1 + Rate)N – 1) Here is my code: double payment=(mrate*(1+mrate)* exp (n)/((1+mrate)* exp(n)-1))*l; BINARY -- modified at 3:22 Monday 31st October, 2005

      R Offline
      R Offline
      Rage
      wrote on last edited by
      #2

      Binary0110 wrote:

      I keep getting errors

      Do you mean compiling errors, or errors in the formula ? ~RaGE();

      1 Reply Last reply
      0
      • B Binary0110

        Can someone help me turn this into c++ code. I thought I had it but I keep getting errors. What am I doing wrong? N is an exponent. Payment = Rate * (1 + Rate)N -------------------- * L ((1 + Rate)N – 1) Here is my code: double payment=(mrate*(1+mrate)* exp (n)/((1+mrate)* exp(n)-1))*l; BINARY -- modified at 3:22 Monday 31st October, 2005

        A Offline
        A Offline
        Arman S
        wrote on last edited by
        #3

        Hi, What do mean saying that N is exponent? Do you mean e^N or x^n? Where have declared the rest of variables; mrate, n, l? double mrate = some_initial_value; double l = some_initial_value; double n = some_initial_value; Anyway, if you mean e^N, the code might look like so: double payment = (mrate * (1 + mrate) * exp(n) / ((1 + mrate) * exp(n) - 1)) * l; If you mean x^N: double payment = pow(mrate * (1 + mrate), n) / (pow((1 + mrate), n) - 1) * l; -- ====== Arman

        1 Reply Last reply
        0
        • B Binary0110

          Can someone help me turn this into c++ code. I thought I had it but I keep getting errors. What am I doing wrong? N is an exponent. Payment = Rate * (1 + Rate)N -------------------- * L ((1 + Rate)N – 1) Here is my code: double payment=(mrate*(1+mrate)* exp (n)/((1+mrate)* exp(n)-1))*l; BINARY -- modified at 3:22 Monday 31st October, 2005

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          Binary0110 wrote:

          ...but I keep getting errors.

          Such as?

          Binary0110 wrote:

          double payment=(mrate*(1+mrate)* exp (n)/((1+mrate)* exp(n)-1))*l;

          Make sure the numeric constants are floating point values, like:

          double payment=(mrate*(1.0+mrate)* exp (n)/((1.0+mrate)* exp(n)-1.0))*l;


          "Take only what you need and leave the land as you found it." - Native American Proverb

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups