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

/* We explore how to use the STL stack.
   A sequence of integers entered by the user
   is printed in reverse order. */

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

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

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

   while(!s.empty())
   {
      int e = s.top();
      s.pop();
      cout << "popped " << e << endl;
   }

   return 0;
}

