检验括号匹配,用到栈的知识

来源:学生作业帮助网 编辑:六六作业网 时间:2025/01/31 20:51:37
检验括号匹配,用到栈的知识检验括号匹配,用到栈的知识检验括号匹配,用到栈的知识#include#includeintisLeftBracket(charch){returnch==''(''||ch==

检验括号匹配,用到栈的知识
检验括号匹配,用到栈的知识

检验括号匹配,用到栈的知识
#include
#include
int isLeftBracket(char ch)
{
return ch=='(' || ch=='[' || ch=='{' || ch=='';
}
int mathcBracket(char left,char right)
{
return (left==')' && right == '(') ||
(left==']' && right == '[') ||
(left=='}' && right == '{') ||
(left=='>' && right == '