how to convert decimal value as string input to its hex equivalent

Reply

Join Date: Feb 2008
Posts: 1
Reputation: angelie is an unknown quantity at this point 
Solved Threads: 0
angelie angelie is offline Offline
Newbie Poster

how to convert decimal value as string input to its hex equivalent

 
0
  #1
Feb 28th, 2008
hi..im a new member and i would like to ask for the code on how to convert a decimal value inputed as string,since all inputs in assembly are in string or character),to its hexadecimal equivalent..thanks..
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,951
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: how to convert decimal value as string input to its hex equivalent

 
0
  #2
Feb 28th, 2008
Hi angelie and welcome to the forums.

We won't give you code here, but we'll be glad to help you with your own code.

There are two things you need to think about for this assignment:
  1. How to convert an ASCII digit character to a number. '0' to 0, '1' to 1, etc, and back.
  2. What is the difference between 1 and 10 and 100. Google "radix" for more. In decimal, the radix is 10. In hexadecimal, the radix is 16, using the ASCII digits 0123456789ABCDEF.
No matter how you represent a number (decimal, hexadecimal, binary, etc.) it is still the same number and it is stored the same way in a machine word.

Hope this helps.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Assembly Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC