This program shows an example of modular programming with the extensive use of functions and examples of parameter passing.
In the main program there are two key functions:
- GetStartingValue () ;
- PlayGame ( ) ;
Within the PlayGame ( ) function there are calls to the other functions that make up the program. These are:
- ComputersTurn () ;
- PlayersTurn () ;
- CheckForWin (PlayerID) ;
One final function is called within PlayersTurn, that is named ValidateData (Minimum, Maximum).
We will examine each function separately before looking at how they work together.