4.3.3 Exercises

Exercise 4.3.1: Fill two containers with the same number of integer values. Create a new container, whose elements are the sum of the appropriate elements in the original container. Hint: The library provides an algorithm and a function object to do the exercise.


Exercise 4.3.2: Write a generator object which can be used with the STL algorithm generate (group 2) to fill containers with certain values. It should be possible to specify a starting value and a step size, so that the first element in the container is the starting value and every further element is the sum of the preceding element and the step size.


Continue with section 4.4

Back to index

Johannes Weidl (J.Weidl@infosys.tuwien.ac.at) - Apr 16, 1996