A stack is a vector that you can address only from one end, known as the top. You usually create it without data, push elements onto the stack, and then pop them off again. This is so similar to the vector that the following code should give all the necessary explanation:
stack<char> my_Lifo; my_Lifo.push( 'a' ); my_Lifo.push( 'b' ); my_Lifo.push( 'c' ); char cLook = my_Lifo.top(); // sneak a preview into cLook char cTake = my_Lifo.pop(); // pop the top off the stack
You can also use the empty and size operators to determine whether the stack contains data, and how much. You do not have any other operators for clearing the stack or interacting with it in any other way.