< Previous | Contents | Next >

Exercises

1. Improve the Word Jumble game by adding a scoring system. Make the point value for a word based on its length. Deduct points if the player asks for a hint.

2. Whats wrong with the following code?

for (int i = 0; i <= phrase.size(); ++i)

{

cout << "Character at position " << i << " is: " << phrase[i] << endl;

}


3. Whats wrong with the following code?

const int ROWS = 2; const int COLUMNS = 3;

char board[COLUMNS][ROWS] = { {’O’, ’X’, ’O’},

{’ ’, ’X’, ’X’} };



chapter 4


image