【问题描述】假设一算术表达式中包括三种括号:圆括号’(‘和’)’; 方括号’[’ 和’]’; 花括号’{’ 和’}’,且三种括号可按任意次序嵌套使用,试编写程序判定输入的表达式所含的括号是否正确配对出现(已知表达式已存入数据元素为字符的顺序表中)。所有括号均为半角符号。
若匹配,则返回1,否则返回0。
【输入形式】含括号的算数表达式
【输出形式】1或0
【样例输入】3+(44*[5-{6*[7*(45-10)]}])
#include<iostream>
#include<malloc.h>
using namespace std;
typedef int ElementType;
typedef struct TreeNode{
ElementType data;
struct TreeNode *lchild;
struct TreeNode *rchild;
}TreeNode, *SearchTree;
int main(){
int *str=(int*)malloc(sizeof(int));
cin>>str;
int i=0;
}
这种方法稍稍的有点点投机取巧哦~