外星人的语言
1 #include <iostream> 2 #include <algorithm> 3 using namespace std; 4 const int maxn = 10005; 5 char biao[] = "0123456789ABCDEF"; 6 int main(){ 7 int a, b; 8 char s[maxn]; 9 int len; 10 while (cin >> a >> b){ 11 len = 0; 12 int t; 13 while (a){ 14 int t; 15 t = a % b; 16 s[len++] = biao[t]; 17 a /= b; 18 } 19 for (int i = len - 1; i >= 0; i--){ 20 cout << s[i]; 21 } 22 cout << endl; 23 } 24 25 //system("pause"); 26 return 0; 27 }