< Previous | Contents | Next >
1. What’s wrong with the following prototype?
int askNumber(int low = 1, int high);
2. Rewrite the Hangman game from Chapter 4 using functions. Include a function to get the player’s guess and another function to determine whether the player’s guess is in the secret word.
3. Using default arguments, write a function that asks the user for a number and returns that number. The function should accept a string prompt from the calling code. If the caller doesn’t supply a string for the prompt, the function should use a generic prompt. Next, using function overloading, write a function that achieves the same results.