#includeusing namespace std; #include int main() { char ch[26];//用来存储26个大写英文字母 char ans[5];//用来存储最终转换后的字母 int index = 0, n ; cout << "请输入数字" << endl; cin >> n;//输入你要转换的数 for (int i = 0; i < 26; i++)//将26个英文字母存储到ch 中 ch[i] = 'A' + i; while (n) { int t = n % 26;//用辗转取余 n = n / 26; if (t == 0) t += 26; ans[index++] = ch[t - 1];//这一步为啥是t-1,因为ch数组的索引从0开始 } for (int i = index - 1; i >= 0; i--)//逆置读取 { cout << ans[i]; } cout << endl; return 0; }



