< Previous | Contents | Next >

Exercises

1. Write a program using vectors and iterators that allows a user to main- tain a list of his or her favorite games. The program should allow the user to list all game titles, add a game title, and remove a game title.

Exercises 149


2. Assuming that scores is a vector that holds elements of type int, whats wrong with the following code snippet (meant to increment each element)?

vector<int>::iterator iter;

//increment each score

for (iter = scores.begin(); iter != scores.end(); ++iter)

{

iter++;

}


3. Write pseudocode for the Word Jumble game from Chapter 3.


This page intentionally left blank



chapter 5


image