The first topic is very simple, that is, the decimation of the decimation is 16, which is the result of all the remaining amounts. I have implemented it with C , the following is the code.
(VC . Net / Windows XP):
#include
#include
Using namespace std;
String tohex (int dec) {unsigned int UDEC = (DEC> = 0)? (DEC): (- DEC), YUSHU; INT POS = 8; Char HEX [11]; MEMSET (HEX, '0', 9) HEX [9] = 'h'; HEX [10] = '/ 0';
Do // Survival Number {YUSHU = UDEC% 16; HEX [POS -] = (YUSHU> 9)? (YUSHU 55) :( YUSHU 48); udec = udec / 16;} while (udec! = 0 ); If (HEX [POS 1]> 64) // If the highest bit is the letter, the string is added to 0 HEX [POS] = '0'; ELSE POS; if (DEC <0) // If It is a negative number, loaded on the front and negative num [- pOS] = '-';
Return (String (HEX POS));} int _tmain (int Argc, _tchar * argv []) {INT i; cin >> i; string shex = tohex (i); cout << Endl << shex; return 0 }