#include #include #include using namespace std; int main () { /* create variable */ list mylist; list stringList; /* create iterator: used to access elements of a list */ list::const_iterator currentList; list::const_iterator currentStringList; /* create empty list */ mylist = list(); stringList = list(); /* add three elements */ mylist.push_front (4); mylist.push_front (5); mylist.push_back (6); stringList.push_front ("AAA"); stringList.push_front ("BBB"); /* display them one by one */ for (currentList = mylist.begin(); currentList != mylist.end(); ++currentList) { cout << "The next element is " << *currentList << "\n"; } for (currentStringList = stringList.begin(); currentStringList != stringList.end(); ++currentStringList) { cout << "The next element is " << *currentStringList << "\n"; } return 0; }