13.07.2015 Views

apple-pascal-1.3-manual

apple-pascal-1.3-manual

apple-pascal-1.3-manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

of all the available games. The user chooses one by typing a number, andthe front-end program chains to the selected game program:PROGRAM FRONT;USES CHAINSTUFF;VAR GAMENUM:INTEGER;BEGIN{Display a greeting}WRITELNC'Welcome to GAMES!'>;WRITELN;{Display the menu}WRITELNC'Select game from list by typing its number:'>;WRITELN;WRITELNC'1WRITELNC '2WRITEUH '3WRITELNC '4WRITELNC'SWRITELNC '6WRITELNC'7WRITELNC '8WR ITELN;Chess');Checkers'>;Blastoff');Gomoku');Backgammon');Black jack'>;Hearts');Sprouts');{Get a number from the user}WRITEC'Type a number from 1 to 8, then press RETURN: ');READLNCGAMENUM>;{Make sure the number is valid}WHILE NOT CGAMENUM IN [1 .. 81) DD BEGINWRITEC'Number must be from 1 through 8-try again: ');READLNCGAMENUM>END;{Set chaining to filename of selected game; use wildcard}CASE GAMENUM OF1: BEGINSETCHAINC'%CHESS'>;2:3:4:5:6:7:8:ENDEND.SWAPDNEND;SETCHAINC'%CHECKERS'>;SETCHAINC'%BLASTOFF'>;SETCHAINC'%GOMOKU');SETCHAIN;SETCHAINC'%BLACKJACK'>;SETCHAINC'%HEARTS'>;SETCHAINC'%SPRDUTS'){Big program; needs extra memory space}Program ChainingIII-279

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!