//有错误,你们谁来我空间就帮我看看吧,谢谢哇
#include<stdio.h>
#define Maxsize 30
typedef struct
{
int s[Maxsize];
int *top;
int *base;
char *c;
}stack;
void initstack(stack *st)
{
st->top=st->base;
}
int push(stack *st,int x)
{
if(st->top-st->base>=Maxsize-1)
return 0;
else
{
*st->top++=x;
return 1;
}
}
int stackempty(stack st)
{
if(st.top==st.base)
return 1;
else
return 0;
}
int pop(stack *st,int *x)
{
if (st->base==st->top)
return 0;
else
{
*x=(*st->top)--;
return 1;
}
}
int stackTraverse(stack st,void(*vi)(int*))
{
int *p;
int i;
p=st.s;
for(i=st.top;i>=st.base;i--)
vi(p++);
printf("\n");
return 1;
}
int vi(int *c)
{
if(*c=='(')
return 1;
else
return 0;
}
int main()
{
char ch;
stack st;
scanf("%c",&ch);
st.base=st.top=0;
initstack(&st);
if(ch=='(')
push(&st,ch);
else if(ch==')')
{
if(stackTraverse(st,vi))
pop(&st,ch);
}
else
push(&st,ch);
printf("that's all.");
}