#include #include using namespace std; int main() { list l; for (int i=0; i<10; i++) { l.push_back(i); } list::iterator it; for (it=l.begin(); it!=l.end();) { cout << *it << endl; if (*it%2 == 0) { l.erase(it++); } else { it++; } } cout << endl; for (it=l.begin(); it!=l.end(); it++) { cout << *it << endl; } }