//创建栈函数
seqStack *create()
{
seqStack *S=(seqStack*)malloc(sizeof(seqStack));
if(NULL==S)
{
printf("创建失败\n");
return NULL;
}
//初始化
S->top = -1; //将栈顶设置为-1
printf("创建成功\n");
return S;
}
//进制转换
int jzzh(seqStack *S)
{
int n;
int num;
int count=0;
printf("请输入你要转换的进制\n");
scanf("%d",&n);
printf("请输入你要转换的十进制数\n");
scanf("%d",&num);
while( num != 0 )
{
int res = num%n;
push(S, res);
num = num/n;
count++;
}
for(int i=0; i<count; i++)
{
pop(S);
}
}
只提供函数体,不提供主函数,请见谅