how to read a hex value and convert it into binary
-
hi i am new to c++ programming.can some one help me in writing to code that will read hex values from the user and convert it into corresponding binary value and display it. Thanks for ur help and time in advance:)
feroz20 wrote:
hi i am new to c++ programming.can some one help me in writing to code that will read hex values from the user and convert it into corresponding binary value and display it.
Have you tried something.. many programmer here are MEMBER of SAY NO TO HOMEWORK brigade
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you
-
hi i am new to c++ programming.can some one help me in writing to code that will read hex values from the user and convert it into corresponding binary value and display it. Thanks for ur help and time in advance:)
Did you try it?
WhiteSky
-
hi i am new to c++ programming.can some one help me in writing to code that will read hex values from the user and convert it into corresponding binary value and display it. Thanks for ur help and time in advance:)
Something like:
int nHex = 0x12345;
char szBinary[64];memset(szBinary, '0', sizeof(szBinary));
for (int x = 0; x < 32; x++)
{
if (nHex & 1)
= '1';nHex >>= 1;
}
strrev(szBinary);
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb