Function to check whether two characters are opening and closing of same type.
| 4 | // Function to check whether two characters are opening |
| 5 | // and closing of same type. |
| 6 | bool ArePair(char opening,char closing) |
| 7 | { |
| 8 | if(opening == '(' && closing == ')') return true; |
| 9 | else if(opening == '{' && closing == '}') return true; |
| 10 | else if(opening == '[' && closing == ']') return true; |
| 11 | return false; |
| 12 | } |
| 13 | bool AreParanthesesBalanced(string exp) |
| 14 | { |
| 15 | stack<char> S; |
no outgoing calls
no test coverage detected