My code not working

#include
#include
#include
using namespace std;
bool checkexpression(string str)
{
stacks;
for (int i = 0; i < str.size(); i++)
{
char curchar = str[i];
if (curchar == ‘(’)
{
s.push(curchar);
}
else if (curchar == ‘)’)
{
if (s.empty() || s.top() != ‘(’)
{
return 0;
}
s.pop();
}
if (s.empty())
{
return 1;
}

}

}

int main()
{
string expr;
cin >> expr;
if (checkexpression(expr))
{
cout<<true;
}
else
{
cout << false;
}

}
why is my code giving wrong output

Please save your code in coding blocks ide and share the link.

Hi,

You are only checking for character ‘(’ you should also check for character ‘{’ and ‘[’.

Think once more and try it yourself.
Still In case of doubt you can refer the code:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.