收起
你的代码的含义是把x转换成char,16进制所以a[] 里面存放的是 '0'-'9'或者 'A'-'Z',而不是0-9你的代码其实不用switch那么复杂直接a[i] = x % 16 > 9 ? x % 16 - 10 + 'A' : x % 16 + '0';即可
报告相同问题?