All pastes #25214 Raw Edit

Tomas

public cpp v1 · immutable
#25214 ·published 2005-10-11 13:20 UTC
rendered paste body
#include <cstdlib>#include <iostream>#include <list>using namespace std;int main(int argc, char *argv[]){    list<int> deelnemers;    list<int>::iterator it;    for (i = 1; i <= D; i++) {        deelnemers.push_back(i);    }    for (it = deelnemers.begin(); it != deelnemers.end(); it++) {        cout << "DBG: nr=" << *it << endl;    }    /* goto begin: */    it = deelnemers.begin();//    while (1) {        /* jump to the list item */        for (i = 0; i < 8; i++) {            it++;        }        cout << "DBG: Remove... nr=" << *it << endl;        deelnemers.erase(it);//    }    system("PAUSE");    return EXIT_SUCCESS;}/*Output:DBG: nr=1DBG: nr=2DBG: nr=3DBG: nr=4DBG: nr=5DBG: nr=6DBG: nr=7DBG: nr=8DBG: nr=9DBG: nr=10DBG: nr=11DBG: nr=12DBG: nr=13DBG: nr=14DBG: nr=15DBG: Eruit... nr=8*/