#include<list>
#include <iostream>
usingnamespace std;
int main()
{
list<double> numList;
//add the values 12.7, 9.65, 8.72 and 4.69 to numList
numList.push_back(12.7);
numList.push_back(9.65);
numList.push_back(8.72);
numList.push_back(4.69);
cout << "numList contains: "<< endl;
//display the list using an iterator
list<double>::iterator itt = numList.begin();
itt++;
itt++;
//remove the element pointed to by itt
numList.erase(itt);
//reverse the list
numList.reverse();
cout << "\nnow numList contains: " << endl;
//display the list again
return 0;
}
I am having trouble finding out the correct code to display the list using an iterator. The notes provided by my school for this section are very vague, and honestly about 3 slides total for all of Lists. Any help would be welcome. Thank you.