I want to do this manually as i dont know how to do it !!
This is a sample input >.
Yeah but can you do manually like on a paper !! because i dont have no idea what the hell is this thing is !!!
i got ascii table .. but how do i find out !!
You need to convert this number representation from decimal (757935403) to hexadecimal (0x2D2D2D2B).
Then you will cleary see the bytes: 0x2D (45) 0x2D (45) 0x2D (45) 0x2B (43)
How to convert to hexadecimal look on this site, google or on youtube.
Last edited on
yeah thats my problem i think
We use hex because it's so easy to see what bits are set where. Decimal doesn't give us individual bits, and binary takes forever to read because you have to count all of the 1s and 0s.
0x0 = 0000 0x8 = 1000
0x1 = 0001 0x9 = 1001
0x2 = 0010 0xA = 1010
0x3 = 0011 0xB = 1011
0x4 = 0100 0xC = 1100
0x5 = 0101 0xD = 1101
0x6 = 0110 0xE = 1110
0x7 = 0111 0xF = 1111
It's best to memorize your hex numbers. Then when you have a 32 bit number 757935403, you can convert it on your programming calculator to 2D 2D 2D 2B and you can see what each bit is doing.
If you want to convert that to ASCII, look it up on your ASCII table. You'll see it turns into
Another easy way to do this in code is to do this with the <iomanip> library:
std::cout << std::hex << test;
or to split it up, you can also use unions:
test.i = 757935403;
std::cout << std::hex << test.i << std::endl;
std::cout << test.c << test.c << test.c << test.c;
Last edited on