#include
#include
#include
#define MAXSIZE 100
typedef struct {
int *top;
int *base;
int stacksize;
}STACK;
void initStack(STACK *S){
S->base=(int * )malloc(MAXSIZE * sizeof(int));
S->top=S->base;
S->stacksize=MAXSIZE;
}
void push(STACK *S,int e){
*S->top =e;
S->top=S->top+1;
}
void pop(STACK *S,int *e){
S->top=S->top-1;
*e = *S->top;
}
void conversion(int n,int d){
int e;
STACK S;
initStack(&S);
while(n){
push(&S,n%d);
n=n/d;
}
printf("after conversion:\n");
pop(&S,&e);
if(e>10){
printf("%c",e-10+'A');
}
else
printf("%d",e);
}
int main() {
int n,d;
printf("input n:\n");
scanf("%d",&n);
printf("input d:\n");
scanf("%d",&d);
conversion(n,d);
return 0;
}