I am making a c++ console app and my issue is that I can not get my braces to match and equal to true when compared to the stack holding the first pair of braces.The method where this algorithm is inserted in has a vector token parameter I have written and rewritten my code several times. In the following post,I am placing a very simple piece of code to show some idea of what i am trying todo:
stack deli;
for (size_t i=0; i<ie.size(); i++) {
if(ie[i].value =="{"|| ie[i].value =="(" || ie[i].value =="[")
{deli.push(ie[i].value);
if(deli.top() != "}" || deli.top() != ")" || deli.top() != "]"){
return false;
deli.pop();
}
if(deli.top() == "}" || deli.top() != ")" || deli.top() != "]"){
return true;
}
}
}//end of for loop