C++上运行正确,PTA运行不出结果
#include<stdio.h>
#include<stdlib.h>
#define Max 100
typedef struct
{
int *top;
int *base;
}SQ;
void in(SQ &S,int e)
{
if(S.top-S.base==Max) exit(0);
*S.top++=e;
}
void out(SQ &S,int &e)
{
if(S.top==S.base) exit(0);
e=*--S.top;
}
int main()
{
SQ S;
int base[Max];
S.base=S.top;
if(!S.base) exit(0);
int x,y;
scanf("%d",&x);
scanf("%d",&y);
while(x!=0)
{
in(S,x%y);
x=x/y;
}
int e;
while(S.top!=S.base)
{
out(S,e);
if(e<=9)
printf("%d",e);
else
printf("%c",e-10+'A');
}
return 0;
}
```