hexadecimal.cpp

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2005
Posts: 15
Reputation: desidude is an unknown quantity at this point 
Solved Threads: 0
desidude desidude is offline Offline
Newbie Poster

Re: hexadecimal.cpp

 
0
  #11
Jul 11th, 2005
well i am lost guys
can anyone suggest me where and how should i start
i will really appreciate
thx
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 76
Reputation: CrazyDieter is an unknown quantity at this point 
Solved Threads: 3
CrazyDieter's Avatar
CrazyDieter CrazyDieter is offline Offline
Junior Poster in Training

Re: hexadecimal.cpp

 
0
  #12
Jul 11th, 2005
Well if you have to write the function that converts numbers into hexadecimal by yourself, try to understand the reuse the function posted by zyrus. Mine use standard library and do not fit for a school project.
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,457
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 251
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: hexadecimal.cpp

 
0
  #13
Jul 11th, 2005
There might be something quite close in the Code Snippets.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 10
Reputation: Kazastankas is an unknown quantity at this point 
Solved Threads: 0
Kazastankas Kazastankas is offline Offline
Newbie Poster

Re: hexadecimal.cpp

 
0
  #14
Jul 13th, 2005
Use modulus (this operator gets the remainder of a / b) 16 repeatedly to get your digits. Use a while loop while dividing the given number by 16 after modulus (use ints, you want truncation) until the given number becomes less than 16.

ie. You have a number, say 254.

254 % 16 = 14. This is your one's digit.
254 / 16 = 15.875 -> 15 after truncation.
15 % 15 = 15. This is your ten's digit.

As for digits, simply use an array of characters for simplicity. Add the characters to the front rather than the end, of course.

Edit: Whoops, not used to the reply tree here. My bad.
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 C++ Forum
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC