Thread: need help with some functions here

  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
    28,413
    What do you mean by "result of a integer in base 2,4 and 8"?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675

  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, 05:30 PM
  2. Functions and Classes - What did I do wrong?
    By redmage in forum C++ Programming
    Replies: 5
    Last Post: 04-11-2005, 11:50 AM
  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, 01:41 PM
  5. Shell functions on Win XP
    By geek@02 in forum Windows Programming
    Replies: 6
    Last Post: 04-19-2004, 05:39 AM