这个代码运行时只能输入4个以内的数有输出4个以上就没有输出了求大神看看#include#include#defineStack_Size50typedefstructSeqstack{intelem[Stack_Size];inttop...
这个代码运行时只能输入4个以内的数有输出 4个以上就没有输出了 求大神看看 #include #include #define Stack_Size 50 typedef struct Seqstack{ int elem[Stack_Size]; int top; }Seqstack; void Initstack(Seqstack *S);/*初... 这个代码运行时只能输入4个以内的数有输出 4个以上就没有输出了 求大神看看 #include #include #define Stack_Size 50 typedef struct Seqstack{ int elem[Stack_Size]; int top; }Seqstack; void Initstack(Seqstack *S);/*初始化*/ int Push(Seqstack *S,int x);/*顺序栈进栈*/ int Pop(Seqstack *S,int x);/*出栈*/ int main() { Seqstack *S; int a; Initstack(S); printf("请输入插入个数:"); scanf("%d",&a); printf("请输入这些数:"); Push(S,a); printf("出栈顺序为:"); Pop(S,a); printf("\n"); return 0; } void Initstack(Seqstack *S) { S->top=-1; } int Push(Seqstack *S,int x) { for(int i=0;itop++; scanf("%d",&S->elem[S->top]); } } int Pop(Seqstack *S,int x) { for(int i=0;ielem[S->top]); S->top--; } } 展开
展开