【文件属性】:
文件名称:数制转换程序实现(C语言)
文件大小:1KB
文件格式:C
更新时间:2012-12-21 13:53:38
数制转换
用C写的
int conversion(int N,int r)
{
PSeqStack S;
int x;
if(!r)
{
printf("error!");
return 0;
}
S=Init_SeqStack();
if(!S)
{
printf("error!");
return 0;
}
while(N)
{
Push_SeqStack(S,N%r);
N=N/r;
}
while(!Empty_SeqStack(S))
{
Pop_SeqStack(S,&x);
printf("%d",x);
}
Destroy_SeqStack(&S);
}