| Kevin Scaldeferri on 28 Jul 2003 04:10:39 -0000 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| [ALACPP] Exceptional C++ : Problem 1 |
Iterators Difficulty: 7The following program has at least four iterator-related problems. How many can you find?
int main()
{
vector<Date> e;
copy( istream_iterator<Date>( cin ),
istream_iterator<Date>(),
back_inserter( e ));
vector<Date>::iterator first =
find( e.begin(), e.end(), "01/01/95");
vector<Date>::iterator last =
find( e.begin(), e.end(), "12/31/95");
*last = "12/30/95";
copy( first,
last,
ostream_iterator<Date>( cout, "\n" ));
e.insert( --e.end(), TodaysDate());
copy( first,
last,
ostream_iterator<Date>( cout, "\n" ));
}
_______________________________________________
alacpp mailing list
alacpp@xxxxxxxxxxx
http://lists.ellipsis.cx/mailman/listinfo/alacpp