SUMMARY

This chapter introduced the capabilities of the STL. My objective in this chapter was to introduce enough of the details of the STL to enable you to explore the rest on your own. Even though this is a substantial chapter, I have barely scratched the surface of the STL’s capabilities so I would encourage you to explore it further.

EXERCISES
1. Write a program that will read some text from the standard input stream, possibly involving several lines of input, and store the letters from the text in a list<T> container. Sort the letters in ascending sequence and output them.
2. Use a priority_queue<T> container to achieve the same result as in Exercise 1.
3. Modify Ex10_12.cpp so that it allows multiple phone numbers to be stored for a given name. The functionality in the program should reflect this: The getEntry() function should display all numbers for a given name, and the deleteEntry() function should delete a particular person/number combination.
4. Write a program to implement a phone book capability that will allow a name to be entered to retrieve one or more numbers, or a number to be entered to retrieve a name.
5. As you know, the Fibonacci series consists of the sequence of integers 0, 1, 1, 2, 3, 5, 8, 13, 21, ... where each integer after the first two is the sum of the two preceding integers (note the series sometimes omits the initial zero). Write a program that uses a lambda expression to initialize a vector of integers with values from the Fibonacci series. ...

Get Ivor Horton's Beginning Visual C++ 2012 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.