// L-13 MCS 360 Wed 22 Sep 2010 : use_stl_vector_as_stack.cpp

/* This program is an adaptation of "use_stl_stack.cpp" to show
   that we can use the STL vector as a stack. */

#include <iostream>
#include <vector>
using namespace std;

int main()
{
   vector<int> s;
   int e;

   do
   {
      cout << "give element (0 to stop) : "; 
      cin >> e;
      if(e <= 0) break;
      s.push_back(e);
   }
   while(true);

   while(!s.empty())
   {
      int e = s[s.size()-1];
      cout << "popped " << e 
           <<  " = " << s.back() << endl;
      s.pop_back();
   }

   return 0;
}

