Merge pull request #2 from wwells4/patch-2

Update Paranthesis Matching.cpp
This commit is contained in:
Chetan Kaushik 2016-10-14 15:57:21 +05:30 committed by GitHub
commit 3465588929

View File

@ -19,7 +19,7 @@ char pop()
bool check(char x, char y) bool check(char x, char y)
{ {
if ( ( x=='(' && y==')' ) || ( x=='{' && y=='}' ) || ( x=='[' && y==']' ) || ( x=='<' && y=='>' ) ) if ((x=='(' && y==')') || (x=='{' && y=='}') || (x=='[' && y==']') || (x=='<' && y=='>'))
{ {
return true; return true;
} }
@ -41,7 +41,6 @@ int main()
if (exp[i]=='(' || exp[i]=='{' || exp[i]=='[' || exp[i]=='<') if (exp[i]=='(' || exp[i]=='{' || exp[i]=='[' || exp[i]=='<')
{ {
push(exp[i]); push(exp[i]);
//show();
} }
else if (exp[i]==')' || exp[i]=='}' || exp[i]==']' || exp[i]=='>') else if (exp[i]==')' || exp[i]=='}' || exp[i]==']' || exp[i]=='>')
{ {