|
|
|
|
|
|
|
Now we are ready to code the simulation of the game. We must remember to initialize our counters. We assumed that we knew the game number for each game, yet nowhere have we kept track of the game number. We need to add a counter to our loop in the main module. Here's the revised main module: |
|
|
|
|
|
|
|
|
Open data files (and verify success)
Set winsForA and winsForB = 0
Set gameNumber = 0
Get plays
WHILE NOT EOF on fileA AND NOT EOF on fileB
Increment gameNumber by 1
IF plays are legal
Process plays
ELSE
Print an error message
Get plays
Print big winner |
|
|
|
|
|
|
|
|
|
Here's the program that implements our design. It assumes we have created our own header file bool.h, whose contents are the statements |
|
|
|
|
|