一个简单的十进制转二进制,八进制或者是十六进制的程序,到底为什么会出错啊?????
#include<stdio.h>main()
{
char a[16]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
int m;
int i,j,base;
char b[64];
printf("please input m:");
scanf("%d",&m);
printf("please input base:");
scanf("%d",&base);
for(;m!=0;m=m/base)
{
i=m%base;
j=0;
b[j]=a[i];
j++;
}
printf("transmite is based on:%d\n",base);
printf("j=%d\n",j);
for(--j;j>=0;j--)
{
printf("%c",b[j]);
}
}
一个简单的十进制转二进制,八进制或者是十六进制的程序,到底为什么会出错啊?????