这是我在 c 中的代码,需要从十进制转换为基数 32。获取奇怪的符号作为输出。
#include <stdio.h>
char * f(unsigned int num){
static char base[3];
unsigned int mask=1,base32=0;
int i,j;
for (j=0;j<3;j++)
for (i=0;i<5;num<<1,mask<<1){
if (mask&num){
base32 = mask|base32;
base32<<1;
}
if (base32<9)
base[j]=base32+'0';
else
base[j]=(char)(64+base32-9);
}
}
基数 32 = 0-9 AV
int main()
{
unsigned int num =100;
printf("%s\n",f(num));
return 1;
}
should get 34.