Connecting Tech Pros Worldwide Help | Site Map

Hexadecimal

  #1  
Old November 17th, 2008, 01:29 AM
Newbie
 
Join Date: Nov 2008
Posts: 1
I'm a beginner and new here. Help can't understand this question.
a program to read 2 characters, and print their value when interpreted as a 2 digit hexadecimal number. Accept upper case letter for value from 10 to 15.
thanks
  #2  
Old November 17th, 2008, 01:43 AM
Ganon11's Avatar
Moderator
 
Join Date: Oct 2006
Location: New York, United States of America
Posts: 3,444

re: Hexadecimal


Are you coding in C or C++?

Do you know what a char is?

Do you know how to read from standard input (i.e. the keyboard)?

Do you know how to print to standard output (i.e. the monitor)?
  #3  
Old November 17th, 2008, 05:48 PM
Moderator
 
Join Date: Mar 2007
Location: North Bend Washington USA
Posts: 5,340

re: Hexadecimal


I suggest you accept two characters and test each one to be a hex digit. If both are, you should be able to convert each character to hex and then add it to your result taking to account the position of the hex character. If you receive:

A6

that is

A * 16 + 6 * 1

Shouldn't be too hard.
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
convert decimal to hexadecimal number sweeet_addiction16@yahoo.com answers 6 September 2nd, 2007 07:55 PM
HEXADECIMAL to STRING Andrea answers 6 June 3rd, 2007 11:35 PM
Convert Binary String to Hexadecimal elliotng.ee@gmail.com answers 7 December 27th, 2006 07:45 PM
How to read a Hexadecimal file ? Vijay answers 8 August 8th, 2006 12:15 AM
sending hexadecimal data to cryptographic hash functions Fernando Barsoba answers 1 November 27th, 2005 12:25 AM