Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to convert decimal integer into hexadecimal integer in C++, and then store the upper two digits and the lower two digits of the hexadecimal number 0x0000 of 16 into two integer variables respectiv
How to convert decimal integer into hexadecimal integer in C++, and then store the upper two digits and the lower two digits of the hexadecimal number 0x0000 of 16 into two integer variables respectiv
How to convert decimal integer into hexadecimal integer in C++, and then store the upper two digits and the lower two digits of the hexadecimal number 0x0000 of 16 into two integer variables respectively. No conversion is needed inside the program.

Your question mainly focuses on how to extract the high and low bits of an unsigned int (32-bit data, namely 0x0000).

The method is as follows:

int a,b,c;

A = 345// Other data can be entered here.

b = a & amp0x 00 ff; //b is the low order of a.

c =(a & amp; 0xff00)>& gt 16; //c is the high position of a.