Connecting Tech Pros Worldwide Help | Site Map

Hexadecimal

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 17th, 2008, 12:29 AM
Newbie
 
Join Date: Nov 2008
Posts: 1
Default Hexadecimal

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
Reply
  #2  
Old November 17th, 2008, 12:43 AM
Ganon11's Avatar
Moderator
 
Join Date: Oct 2006
Location: New York, United States of America
Age: 20
Posts: 3,444
Default

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)?
Reply
  #3  
Old November 17th, 2008, 04:48 PM
Moderator
 
Join Date: Mar 2007
Location: North Bend Washington USA
Age: 68
Posts: 5,177
Default

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
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search


Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.