Hi dudes,
i have a problem in using cin function.
i've written code for checking parantheses Balance,
it works only for non-empty strings, but doesn't work for empty strings.
however i know the problem is coming from cin function, but i can't handle it!
here is a part of my code,
thanks in advance, for any help
Code:
int main()
{
int n;
cin>>n;
string st;
vector<string> vct;
while(n!=0)
{
cin>>st;
if (st.empty())
{
//string is empty and Balanced
//n--;
}
else
{
if(checkBalanced(st))
vct.push_back("Yes");
else
vct.push_back("No");
n--;
}
}
for (int i=0 ; i<vct.size() ; i++)
cout << vct.at(i) << endl;
return 0;
}