#include <iostream>
using std::cout;
using std::endl;
#include <stack> // stack adapter definition
#include <vector> // vector class-template definition
#include <list> // list class-template definition
int main()
{
// stack with default underlying deque
std::stack< int > intStack;
for ( int i = 0; i < 10; i++ )
{
intStack.push( i );
cout << "\n\n\npushing: "<< intStack.top() << ' \n';
}
while ( !intStack.empty() )
{
cout << "\n\n\ntopping: "<<intStack.top() << ' \n';
intStack.pop();
}
return 0;
}
|