home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols000 / vol064 / query.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1984-04-29  |  808 b   |  30 lines

  1. program queryx;
  2. {$I+,m-,c-,f-}
  3. type
  4. byte = 0..255;
  5. $string255 = string 255;
  6.  
  7. var
  8. answer:char;
  9. procedure move_cursor(x,y:byte);external;
  10. procedure keyin (var cix:char);external;
  11. FUNCTION QUERY(X,Y:BYTE;MESSAGE:$STRING255;BELL:BOOLEAN):BOOLEAN;
  12.  
  13. {function to move the cursor to position x,y, display an interrogative
  14.  message, ring a bell to alert the operator, if desired, and then accept
  15.  either an upper or lower case "y" or "n", in answer to the message.
  16.  This function returns a boolean TRUE if the answer to the question is
  17.  affirmative (yes).}
  18.  
  19.  
  20. BEGIN
  21.     REPEAT
  22.     MOVE_CURSOR(X,Y);
  23.     IF BELL = TRUE THEN WRITE(CHR(7),MESSAGE) ELSE WRITE(MESSAGE);
  24.     KEYIN(ANSWER);
  25.     WRITE(ANSWER);
  26.     UNTIL ANSWER IN ['y','n','Y','N'];
  27.     QUERY:= ( (ANSWER = 'Y') or (ANSWER = 'y') );
  28. END;
  29.  
  30. begin end.