#include <iostream>
#include <list>
using namespace std;
int main()
{
list<int> listObject1, listObject2;
int i;
for(i=0; i<10; i++) listObject1.push_back(i);
for(i=0; i<10; i++) listObject2.push_front(i);
list<int>::iterator p;
cout << "Contents of listObject1:\n";
p = listObject1.begin();
while(p != listObject1.end()) {
cout << *p << " ";
p++;
}
cout << "\n\n";
cout << "Contents of listObject2:\n";
p = listObject2.begin();
while(p != listObject2.end()) {
cout << *p << " ";
p++;
}
return 0;
}
|