原理:十进制N和其他d进制数的转换,N=(N div d) + N mod d;
1.栈的实现
typedef struct{
int *base;
int* top;
int stacksize;
};
void Turn(){
InitStack(S);
scanf("%d",N);
while(N)
{
Push(S,N%8); //以八进制为例
N=N/8;
}
while(!StackEmpty(S)){
Pop(S,e);
printf("%d" ,e);
}
}