Mega Code Archive
Push and pop a stack of list
#include
using std::cout;
using std::endl;
#include // stack adapter definition
#include // vector class-template definition
#include // list class-template definition
int main()
{
// stack with underlying list
std::stack< int, std::list< int > > intListStack;
for ( int i = 0; i < 10; i++ )
{
intListStack.push( i );
cout << "\n\n\npushing: "<< intListStack.top() << ' \n';
}
while ( !intListStack.empty() )
{
cout << "\n\n\ntopping: "<