Thread: Conversion of hexidecimal to decimal

  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    4

    Conversion of hexidecimal to decimal

    Hi there i already got the programming for decimal to hexidecimal.. can someone guide me hw to do hexidecimal to decimal

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459

  3. #3
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Nice to occasionally know my comments are ignored.

  4. #4
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Occasionally? Haha who are you kidding?

  5. #5
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Nobody. I just only receive the notification itself occasionally, such as this case. I'm sure the rate of people ignoring me is much higher than that. I just like receiving the confirmation.

  6. #6
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    [sarcasm]
    Huh, did somebody say something...
    [/sarcasm]

    "guide" you, huh? Well you start telling us where you are stuck.
    Last edited by iMalc; 07-09-2007 at 03:16 AM.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    A better question is why you haven't coded up two general purpose routines

    int stringToInt( char *string, int inBase );
    void intToString( char *result, int value, int outBase );

    At the moment, you're relying on scanf to achieve
    result = stringToInt( "1234", 10 );

    I mean, once you understand all the /BASE and %BASE logic, converting to/from any base is a doddle. A couple of functions with some parameters (eg, the base to use) should see you solving all 6 cases in one go, not as you are at the moment hand crafting each solution as a special case.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 07-04-2008, 12:39 PM
  2. how to do conversion decimal to hexidecimal
    By twocool82 in forum C Programming
    Replies: 7
    Last Post: 07-08-2007, 06:20 PM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. binary decimal conversion
    By eerok in forum C Programming
    Replies: 2
    Last Post: 01-24-2006, 09:51 PM
  5. Help with decimal to hexidecimal program
    By CheeseMonkey in forum C++ Programming
    Replies: 1
    Last Post: 12-22-2001, 03:15 PM