Decimal to Hex

This is a discussion on Decimal to Hex within the C Programming forums, part of the General Programming Boards category; Hi guys, i did some massive searching but i am wondering if anyone knows a simple and fast way to ...

  1. #1
    zee
    zee is offline
    Registered User
    Join Date
    Jun 2004
    Posts
    34

    Decimal to Hex

    Hi guys, i did some massive searching but i am wondering if anyone knows a simple and fast way to convert a decimal number to a binary. Easiest way u can think of. I have to literally calculate the binary doing it my way. Wondering if there is a cool function that does it for u

  2. #2
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,806
    well if you can calculate it just implement that into a function and use that function everytime you want to convert
    Woop?

  3. #3
    ~viaxd() viaxd's Avatar
    Join Date
    Aug 2003
    Posts
    246
    a decimal number to a binary
    why does your thread name say 'Decimal to Hex' then?

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    You're kidding, right? You did "massive searching"? And you didn't find anything?

    Quzah.
    Hope is the first step on the road to disappointment.

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >Easiest way u can think of.
    Code:
    long double
    dtob(
      int d
      )
    {
      return d ? dtob(d >> 1) * 10 + (d & 1) : 0;
    }
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 11
    Last Post: 03-24-2006, 10:26 AM
  2. hex to binary,hex to decimal
    By groovy in forum C Programming
    Replies: 2
    Last Post: 01-25-2006, 01:14 AM
  3. Converting decimal to hex
    By cobrakidd in forum C++ Programming
    Replies: 9
    Last Post: 02-06-2003, 10:37 AM
  4. about decimal to hex progam
    By Abdi in forum C Programming
    Replies: 2
    Last Post: 06-01-2002, 07:08 PM
  5. Decimal vs. Hex
    By -leech- in forum C Programming
    Replies: 6
    Last Post: 02-18-2002, 11:51 AM

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