把NUMBER 以RADIX进制输出,但是出错了
#include <stdio.h>#include <stdlib.h>
void GetCode(int, int);
int main(void)
{
int number, radix;
printf("要转换的十进制数:");
scanf("%d", &number);
printf("要转换成的进制:");
scanf("%d", &radix);
GetCode(number, radix);
return 0;
}
void GetCode(int number, int radix)
{
int num[100];
int i, mode, iCount;
iCount = 0;
for(i = 0; i <= 100; i++)
{
mode = number % radix;
number = number / radix;
num[i] = mode;
iCount++;
if(number = 0)
{
break;
}
}
while(iCount >= 0)
{
printf("(%d)", num[iCount--]);
}
}