Base Conversions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RandomPscho
    FFR Player
    • Jun 2006
    • 504

    #1

    Base Conversions

    Hey all,
    I have to make a program that converts from any base number system to another. I know how to do anything to base ten, but how do you go from anything to anything?

    Going to base ten is simple:

    digit3 * base^2 + digit2 *base^1 +digit1*base^0 etc;
    but how do you set it up to go from other bases? I know its easy, but I can't think of the setup -.-

    Thanks.
  • RandomPscho
    FFR Player
    • Jun 2006
    • 504

    #2
    Re: Base Conversions

    Thanks for the help everyone :/

    I got it working.

    Comment

    • AirForceBlue
      FFR Player
      • Mar 2007
      • 64

      #3
      Re: Base Conversions

      Congrats on getting it working =]

      Sorry about that, I honestly didn't know how I could get that done. What language were you doing this in?

      Comment

      • RandomPscho
        FFR Player
        • Jun 2006
        • 504

        #4
        Re: Base Conversions

        Java -- all standard classes (String Scanner and StringBuffer is all I used I think :s, oh and the Math class )
        Last edited by RandomPscho; 03-12-2007, 02:26 PM.

        Comment

        • Zovistograt
          FFR Player
          • Apr 2007
          • 27

          #5
          Re: Base Conversions

          I know it has something to do with s.toString(int, int)...with s being a String and those two ints being something and the base you want...I forgot the exact usage though
          http://spzc.net/

          Comment

          • RandomPscho
            FFR Player
            • Jun 2006
            • 504

            #6
            Re: Base Conversions

            Originally posted by Zovistograt
            I know it has something to do with s.toString(int, int)...with s being a String and those two ints being something and the base you want...I forgot the exact usage though
            Ummm, what?

            Comment

            • g4z33b0
              Banned
              • Mar 2006
              • 2618

              #7
              Re: Base Conversions

              Oh damn I wish I had my old C++ base converter for you, it did any conversion from 32 down.

              Comment

              • RandomPscho
                FFR Player
                • Jun 2006
                • 504

                #8
                Re: Base Conversions

                Mine does up to 35

                Comment

                Working...