Category : Pascal Source Code
Archive   : USNGTP.ZIP
Filename : LST01-01.PAS

 
Output of file : LST01-01.PAS contained in archive : USNGTP.ZIP

program Display_Keys;

const QUIT = ^Q;

var inchr : Char;

{ Prompts user to press a key and then displays the
video representation and the ASCII code produced
by that key. Uses the Turbo predefined device Kbd.}

begin
ClrScr;
WriteLn('Press a key to display its ASCII Code');
WriteLn('Press to QUIT');
repeat
Read(Kbd,inchr);
WriteLn('The ASCII code for ',inchr,' is ',Ord(inchr));
until (inchr = QUIT);
end.

{ Listing. 1-1 Your first Pascal program. }