PROG8.PAS  ·  PAS  ·  1.3 KB  ·  1985-08-25  ·  from IBM-PC-User-Group-Software-Library_Disk-101-Turbo-Lessons
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.