标签:count 转换 har bsp print ++ 简单 else ever
int change(int x, int ch)
{
int tmp = x;
int bit[10] = {0};
char everybit[5] = {‘A‘, ‘B‘, ‘C‘, ‘D‘, ‘E‘};
int count = 0;
while(tmp != 0) // 辗转相除法求对应进制
{
bit[count] = tmp % ch;
//printf("%d\n", bit[count]);
tmp = tmp / ch;
count ++;
}
int i;
for(i = count - 1; i >= 0; i --) // 倒序输出对应的值
{
if(bit[i] >= 10)
printf("%c", everybit[bit[i] - 10]);// 十进制以上符号转换
else
printf("%d", bit[i]);
}
printf("\n\n");
}
—
标签:count 转换 har bsp print ++ 简单 else ever
原文地址:https://www.cnblogs.com/yusuph/p/13204570.html