Find the answer to your Linux question:
Results 1 to 9 of 9
I am very new to C++, and I need a little help. I want to make a simple finacial calculator, but how do I write "X^Y"...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2005
    Location
    Roskilde, Denmark
    Posts
    93

    C++ problem


    I am very new to C++, and I need a little help. I want to make a simple finacial calculator, but how do I write "X^Y"

  2. #2
    Just Joined!
    Join Date
    Mar 2005
    Location
    Indiana
    Posts
    54
    "X^Y" is a string. If you want X^Y, use pow(X,Y). You'll need the cmath header file: #include <cmath>.

  3. #3
    Just Joined!
    Join Date
    Mar 2005
    Location
    Roskilde, Denmark
    Posts
    93

    root

    thanks. Helped me a lot. But do you know how to find a root of a number? Say 3rd root of 8.[/img]

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Feb 2005
    Location
    Ottawa, Canada
    Posts
    39

  6. #5
    Just Joined!
    Join Date
    Feb 2005
    Location
    Ottawa, Canada
    Posts
    39
    Hmmm looking briefly at that side and the math.h functions, I don't see one that calculates any other root than squares... HMMM...

  7. #6
    Linux Newbie
    Join Date
    Jan 2005
    Posts
    157
    pow(n,.5) is the square root, pow(n, .333) is the 3rd root etc..

    omg duh!!
    the help was meant for Veli..
    I think I caught your sarcasm.
    If (exoskeleton || (green && wiggles)) eat_it();

  8. #7
    Just Joined!
    Join Date
    Feb 2005
    Location
    Ottawa, Canada
    Posts
    39
    omg duh!!

    8^1/3 = 2!

    Me smart like truck

  9. #8
    Just Joined!
    Join Date
    Mar 2005
    Location
    Roskilde, Denmark
    Posts
    93
    Thank you. I managed to finish my program. Not a very useful application, but you have to start somewhere, right?

  10. #9
    Linux Newbie
    Join Date
    Mar 2005
    Location
    Bangalore, INDIA
    Posts
    122

    msdn

    hi
    i think u need a msdn copy, it is extensive and somtimes helpful........
    bye
    Portability is for people who cannot programme

Posting Permissions

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