] > The C++ Standard Template Library (STL)

9.6 The C++ Standard Template Library (STL)

#include <iostream> 
#include <stack> 
using namespace std; 
 
int main () 
{ 
  stack<int> mem; 
  for (int i=1; i<=10; i++) 
  { 
     mem.push(i); 
  } 
  while(!mem.empty() ) 
  { 
    cout << mem.top() << endl; 
    mem.pop(); 
  } 
  return 0; 
}
10  
9  
8  
7  
6  
5  
4  
3  
2  
1

[STL stack] [stack.cpp]