怎么改??
#define Elemtype int#define MAXSIZE 100
#include <stdio.h>
typedef struct
{
Elemtype data[MAXSIZE];
int top;
}SeqStack;
void initStack(SeqStack*s)
{
s->top=0;
}
Elemtype getTop(SeqStack*s)
{
Elemtype x;
if(s->top==0)
{printf("栈空\n");
x=0;
}
else
x=(s->data)[s->top];
return x;
}
int push(SeqStack*s,Elemtype x)
{
if(s->top==MAXSIZE-1)
{
printf("栈满\n");
return 0;}
else
{
s->top++;
(s->data)[s->top]=x;
return 1;
}
}
Elemtype pop(SeqStack*s)
{
Elemtype x;
if(s->top==0)
{
printf("栈空\n");
x=0;}
else
{
x=(s->data)[s->top];
s->top--;
}
return x;
}
main()
{
SeqStack stack,*s;
int n;
s=&stack;
initStack(s);
n=0;
printf("输入一: ");
scanf("%d",&n);
push(s,'#');
while(n!=0)
{
push(s,n%8);
n=n/8;
}
printf("\n\n对应的数: ");
while(getTop(s)!='#')
printf("%d",pop(s));
printf("\n");
}
这个十进制转八进制的程序,添加几个条件语句怎么改为十进制转十六进制