There are several ways to write that program. Probably one of the simplest is to use vectors and iterators.
Step 1: Create a vector of ints that will hold all the numbers from 0 to ???
Step 2: create a function that displays all the numbers in the vector. Pass the vector to this function by reference.
Step 3: create a vector<int>::iterator that will be used to iterate through the list
Step 4: in a loop call vector's erase() method to erase the value currently pointed to by the iterator, then increment the iterator, Continue this loop until the vector >= to the vector's end() method. On each iterator of the loop call the function you wrote in step #2 above.