Here is the piece of code I am having trouble with:
if (stack_flag == true) {
bool hangar = false;
while (hangar == false) {
unsigned int index = s_move.top();
unsigned int edge = map[index].get_which_edge();
char current = map[index].get_char();
s_move.pop();
A stack container is used if my program takes command line input that says to do so; that's what the stack flag is. This is the first couple lines of my loop. The stack is initialized with one value. The problem I'm having is that I need to get the value of the top element on the stack and I also need to pop that element off the stack right after, but the top() function returns a reference to the top value. When I pop the value off the reference is no longer useful. Is there another way to get the value from the stack while popping it off right after? My error is: s_move was not declared in this scope.
s_move was not declared in this scopemeans what it says: You don't have a stack, or anything else, nameds_movethat's accessible to this code. This could be a simple typo, or it could mean you're trying to access a local variable from a completely different function, or it could mean you've forgotten to#includesomething, or… But whatever it is, everything else is irrelevant until you fix that. - abarnert