C++ exercise: no for-loops
Submitted By:
bilderbikkel
Rating:





(
Rate It)
Share:
By Email
Visit
Description
Reading the literature, one reads to prefer algorithms over loops (Stroustrup, Sutter). This is easier said than done. In this exercise you must replace for-loops by using a combination of all those algorithm things like std::for_each, std::transform, std::bind1st, std::bind2nd, std::multiplies and more of the likes. It is up to you to find the correct combination.
Comments (2)
c++




Posted by: sabbir on Wednesday, January 13, 2010
How does these std::methods work?




Posted by: Cuckoo on Thursday, August 19, 2010
Just as the subject. For example, std::for_each is expend the loop?
for(int i = 0; i< 3:++i)
{
func(i);
}
is replace by
func(0);
func(1);
func(2);
but the complier prefer do that.
Add Your Rating