if ((!error) && isEmpty(s))
cout<<"\nResult: This expression is not balanced. \n"<<endl;
else
cout <<"\nResult: This expression is balanced. \n"<<endl;
The expression is not balanced if error is true (too many closing parens)
OR if the stack is NOT empty (too few closing parens).