From c2b06a019fd429ef274f84e8f0f92fd5b67f56c4 Mon Sep 17 00:00:00 2001 From: wwells4 Date: Fri, 14 Oct 2016 01:24:38 -0700 Subject: [PATCH] Update Paranthesis Matching.cpp --- Paranthesis Matching.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Paranthesis Matching.cpp b/Paranthesis Matching.cpp index 0e4555d4e..5d37a161e 100644 --- a/Paranthesis Matching.cpp +++ b/Paranthesis Matching.cpp @@ -19,7 +19,7 @@ char pop() 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; } @@ -38,12 +38,11 @@ int main() gets(exp); for (int i = 0; i < strlen(exp); i++) { - if (exp[i]=='(' || exp[i]=='{' || exp[i]=='[' || exp[i]=='<') + if (exp[i]=='(' || exp[i]=='{' || exp[i]=='[' || 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]=='>') { if(!check(pop(), exp[i])) {