PROG7.PAS 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. PROGRAM PROG7;
  2. {$U+ Copyright (C), 1985 by Lyle Faurot. All rights reserved.
  3. New Topics: REPEAT statement
  4. CHAR data type
  5. }
  6. VAR
  7. Response : Char;
  8. Correct_Response : Boolean;
  9. BEGIN
  10. WriteLn('Turbo Pascal seems to ');
  11. WriteLn;
  12. WriteLn('A. Run faster than other Pascals.');
  13. WriteLn('B. Compile faster than others.');
  14. WriteLn('C. Take less room in memory.');
  15. WriteLn('D. All of the above.');
  16. WriteLn;
  17. REPEAT
  18. Write('Enter your choice - A, B, C, or D: ');
  19. ReadLn(Response);
  20. WriteLn;
  21. If (Response = 'D') or (Response = 'd')
  22. THEN
  23. Correct_Response := True
  24. ELSE
  25. Correct_Response := False;
  26. If Correct_Response
  27. THEN
  28. WriteLn('Right!')
  29. ELSE
  30. WriteLn('Wrong choice, try again.');
  31. UNTIL Correct_Response;
  32. END.
  33.