大神们,求解?运行不出来啊!
程序代码:
#include<stdio.h> #define MAXSIZE 40 struct SStack {int data[MAXSIZE]; int top; }; void InitSStack(struct SStack *S) { S->top=-1; } int PushSStack(struct SStack *S,int x) {if(S->top==MAXSIZE-1) {printf("栈满,不能进栈"); return 0;} else {S->top++; S->data[S->top]=x; return 1; } } int PopSStack(struct SStack*S) {int x;if(S->top==-1) {printf("栈空,不能出栈"); return 0;} else {x=S->data[S->top]; S->top--; return x;} } void F(int a,struct SStack *S) {int b; do {b=a%8; PushSStack(S,b); a=a/8;}while(a); } void main() {int a;struct SStack S; printf("请输入一个十进制数"); scanf("%d",&a); F(a,&S); while(S.top!=0) printf("%d",PopSStack(&S)); }