| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- PROGRAM PROG8;
- {$U+ Copyright (C), 1985 by Lyle Faurot. All rights reserved.
- New Topics: CASE statement
- Block statement
- }
- VAR
- Response : Char;
- Correct_Response : Boolean;
- BEGIN
- WriteLn('Turbo Pascal seems to ');
- WriteLn;
- WriteLn('A. Run faster than other Pascals.');
- WriteLn('B. Compile faster than others.');
- WriteLn('C. Take less room in memory.');
- WriteLn('D. All of the above.');
- WriteLn;
- REPEAT
- Write('Enter your choice - A, B, C, or D: ');
- ReadLn(Response);
- WriteLn;
- CASE Response OF
- 'A','a',
- 'B','b',
- 'C','c' : BEGIN
- WriteLn('Correct, but not the best answer.');
- WriteLn('Please try again.');
- Correct_Response := False;
- END;
- 'D','d' : BEGIN
- WriteLn('Correct - these all seem to be true.');
- Correct_Response := True;
- END;
- ELSE
- BEGIN
- WriteLn(Response,' was not one of the choices. Try again.');
- Correct_Response := False;
- END;
- END; {CASE}
- UNTIL Correct_Response;
- END.
|