|
-
#include <iostream>
#include <list>
using namespace std;
int main ()
{
// Two ints with a value of 100:
list< int > mylist( 2, 100 );
mylist.push_front( 200 );
mylist.push_front( 300 );
mylist.push_back( 555 );
cout << "mylist contains:";
list<int>::iterator it;
for ( it = mylist.begin(); it != mylist.end(); ++it )
{
cout << " " << *it;
}
cout << endl;
return 0;
}
/* Program output:
mylist contains: 300 200 100 100 555
*/
|