A list iterator is an object that accesses the elements
in a list in their position of order.
The list class includes iterator as a nested
class within its declaration.
The operators of the
class list::iterator
are
*,
++, --, ==, !=
(Please apply the concept of pointers to iterator)
There are two functions in the class list that return iterator datatype:
using namespace std;
void main()
{
list<double>
DayIncome(5,0);
list<double>::iterator
ptr;
ptr
= DayIncome.begin();
for(int
i=1; i<6; i++)
{
*ptr = *ptr + i*5;
ptr++;
}
ptr
= DayIncome.begin();
while(
ptr != DayIncome.end())
{
cout<<*ptr<<endl;
ptr++;
}
}