a); p=p->next; }?} else printf("队列为空\n"); printf("\n"); return0;}//遍历链式栈intClearStack(SqStack&S){?S.top=NULL;?printf("已置空链式栈");?printf("\n");?return0;}//置空链式栈voidmain(){?SqStackS;?inte,m;?printf("\n");printf("\n");printf("\n");printf("\n");?printf("1——插入元素;2——删除元素;3——返回栈顶元素4——置空链式栈0——结束运行\n");?printf("\n");printf("\n");printf("\n");?InitStack(S);?printf("\n");printf("\n");?printf("选择:");?scanf("%d",&m);?printf("\n");printf("\n"); while(m!=0) { switch(m) { case1:printf("插入元素:");scanf("%d",&e);Push(S,e);PrintStack(S);printf("\n");printf("\n");break; case2:Pop(S);PrintStack(S);printf("\n");printf("\n");break; case3:GetTop(S);printf("\n");printf("\n");break; case4:ClearStack(S);printf("\n");printf("\n");break; } printf("选择:"); scanf("%d",&m); printf("\n");printf("\n"); }?printf("结束运行。再见!\n");}