指教一下那出错了,小女子在这谢过了。
#include <stdio.h>#include <stdlib.h>
typedef struct
{
int *Top;
int *Bottom;
} Stack;
int Initstack(Stack *s)
{
s->Top=(int *)malloc(sizeof((int *)100));
s->Bottom=s->Top;
}
int push(Stack *s,int n)
{
*s->Top=n;
s->Top++;}
}
int Pop(Stack *s,int e)
{
if(s->Top!==s->Bottom)
s->Top--;
e=*s->Top;}
return e;
}
main()
{
Stack s;
int n,e;
printf("请输入一个正整数:");
scanf("%d",&n);
while(n!=0)
{
push(s,n%8);
n=n/8;
}
while(s->Top!=s->Bottom)
{
e=Pop(s,e);
printf("%3d",e);
}
printf("\n");
}