📄 ss_khpp.cpp
字号:
#include "ss.cpp"
void Match(char a[]){
int i=0;
SqStack S;
ElemType e1,e2,e3;
InitStack(S);
printf("\n%s\n",a);
while(a[i]!='\0'){
e1=a[i];
switch(e1){
case '(':
Push(S,e1);i++;break;
case '[':
Push(S,e1);i++;break;
case ')':
if(!GetTop(S,e2)){printf("NOT MATCH!"); exit(ERROR);}
if(e2=='('){Pop(S,e3);i++;break;}
else{printf("NOT MATCH!"); exit(ERROR);}
case ']':
if(!GetTop(S,e2)){printf("NOT MATCH!"); exit(ERROR);}
if(e2=='['){Pop(S,e3);i++;break;}
else{printf("NOT MATCH!"); exit(ERROR);}
default:
i++;
}//switch
}//while
if(S.top==S.base)printf("VERY GOOD! IT IS MATCHED!");
else printf("NOT MATCH!");
}
void main(){
char bds[]="(([(([[e]g])))])";
Match(bds);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -