March 2010
Beginner
760 pages
18h 51m
English
Character sets are valuable for many different purposes in your programs. For example, one common use of character sets is to validate user input. This section will also present a couple of other applications for character sets to help you start thinking about how you could use them in your program.
Consider the following short code segment that gets a yes/no-type answer from the user:
static
answer: char;
.
.
.
repeat
.
.
.
stdout.put( "Would you like to play again? " );
stdin.FlushInput();
stdin.get( answer );
until( answer = 'n' );A major problem with this code sequence is that it will stop only if the user types a lowercase n character. If the user types anything other than n (including uppercase ...