Example 17
We'll extend the idea now so that one user types in a
number and the other person tries to guess it...
1. Design a Solution
Here's our design for the guessing game.
1. get number from
player 1
2. get guess(es) from player 2 until guess is
correct
3. print message
Step 1 becomes:
1.1 prompt player 1
for number
1.2 read in number
1.3 clear the screen
Step 2 becomes:
2.1 repeat
2.2 prompt player 2 for
guess
2.3 read in guess
2.4 until guess is correct
So the complete design is:
|