0001 #include "convert.h" 0002 0003 int main() { //进制转换 0004 srand(31415926); //srand((uint32_t) time(nullptr)); //随机种子 0005 uint64_t n = 0; 0006 for (int i = 0; i < 4; i++) 0007 { n <<= 16; n |= (rand() & 0x1) << 15 | rand(); } 0008 if (0 == n) n = 1; 0009 for (int base = 2; base < 17; base++) { 0010 printf("%20llu_(10) = ", n); 0011 convert(n, base); // 进制转换 0012 printf("_(%d)\n", base); 0013 } 0014 return 0; 0015 }