< Previous | Contents | Next >

Exercises

1. Rewrite the Menu Chooser program from this chapter using an enumera- tion to represent difficulty levels. The variable choice will still be of type int.

2. Whats wrong with the following loop?

int x = 0; while (x)

{

++x;

cout << x << endl;

}


3. Write a new version of the Guess My Number program in which the player and the computer switch roles. That is, the player picks a number and the computer must guess what it is.



chapter 3


image