need help with some functions here

This is a discussion on need help with some functions here within the C++ Programming forums, part of the General Programming Boards category; can anyone here give me a c++ example of result of a integer in base 2,4 and 8 please.. i ...

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    61

    need help with some functions here

    can anyone here give me a c++ example of result of a integer in base 2,4 and 8 please..
    i am working on a program on this.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,304
    What do you mean by "result of a integer in base 2,4 and 8"?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,657

  4. #4
    The larch
    Join Date
    May 2006
    Posts
    3,573
    Well

    89
    in base 8 is:
    1 * 8 ^ 0 + 3 * 8 ^ 1 + 1 * 8 ^ 2
    in base 4:
    1 * 4 ^ 0 + 2 * 4 ^ 1 + 1 * 4 ^ 2 + 1 * 4 ^ 3
    in base 2:
    1 * 2 ^ 0 + 0 * 2 ^ 1 + 0 * 2 ^ 2 + 1 * 2 ^ 3 + 1 * 2 ^ 4 + 0 * 2 ^ 5 + 1 * 2 ^ 6

    See a pattern?

    You can use modulus and division in a loop to obtain the multipliers.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Void Functions Help
    By bethanne41 in forum C++ Programming
    Replies: 1
    Last Post: 05-09-2005, 06:30 PM
  2. Functions and Classes - What did I do wrong?
    By redmage in forum C++ Programming
    Replies: 5
    Last Post: 04-11-2005, 12:50 PM
  3. calling functions within functions
    By edd1986 in forum C Programming
    Replies: 3
    Last Post: 03-29-2005, 03:35 AM
  4. Factory Functions HOWTO
    By GuardianDevil in forum Windows Programming
    Replies: 1
    Last Post: 05-01-2004, 02:41 PM
  5. Shell functions on Win XP
    By geek@02 in forum Windows Programming
    Replies: 6
    Last Post: 04-19-2004, 06:39 AM

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