标签:
#include <iostream> #include "stdio.h" #include "stdlib.h" #include "memory.h" using namespace std; int main(int argc, char *argv[]) { unsigned int num ; cin >> num; int tmp[9999];//余数 int tmpp[9999];//商 tmp[0] = num; tmpp[0] = num; int x=1; do { tmp[x] = tmpp[x - 1] % 16; tmpp[x] = tmpp[x-1] / 16; x++; } while (tmpp[x - 1] != 0); //输出 for ( int xx = x-1; xx>=1; xx--) { switch (tmp[xx]) { case 10:cout << "A"; break; case 11:cout << "B"; break; case 12:cout << "C"; break; case 13:cout << "D"; break; case 14:cout << "E"; break; case 15:cout << "F"; break; default:cout << tmp[xx]; break; } } cout << endl; system("pause"); return 0; }
标签:
原文地址:http://my.oschina.net/u/1391394/blog/387188