So I'm flustered by this bit of code - can't understand why it's misbehaving. The only thing I can think of is that stack.empty() isn't working properly with the while loop, but that seems ridiculous. You'll see in the output following the code that the program never makes it out of the while loop before the run fails.
declaration of opStack and newOrder:
queue<string> newOrder;
stack< vector<char> > opStack;
other stuff happens, then this code executes:
while(opStack.empty()==false){
if(opStack.top()[1] != 'L'){
cout<<"is stack empty?:"<<opStack.empty()<<endl;
symbol = opStack.top()[0];
newOrder.push(symbol);
opStack.pop();
cout<<"popped stack;"<<endl;
cout<<"is stack empty?:"<<opStack.empty()<<endl;
}
else{
break;
}
}
cout<<"made it out of while loop";
output:
is stack empty?:0
popped stack;
is stack empty?:1
RUN FAILED (exit value 1, total time: 1s)