
题目
解决代码及点评
/* 将数字转化成16进制输出 */ #include <iostream> using namespace std; char * get2String(long num) { int i = 0; char * buffer = NULL; char * temp = NULL; buffer = (char *)malloc(33); temp = buffer; for(i=0; i<32; i++) { temp[i] = num & (1 << (31 - i)); temp[i] = temp[i] >> (31 - i); temp[i] = (temp[i] == 0) ? '0' : '1'; temp[i] = (c