9
|
1 $TITLE DumpReal
|
|
2 $SUBTITLE Global Definitions
|
|
3 PROGRAM dumpreal;
|
|
4 VAR
|
|
5 badvar: ^anotherbadvar;
|
|
6 i : integer;
|
|
7 hexc : ARRAY[0..15] OF char;
|
|
8 trix : RECORD
|
|
9 CASE boolean OF
|
|
10 true :(r: real);
|
|
11 false:(c: ARRAY[1..5] OF char)
|
|
12 END;
|
|
13 $subtitle Procedure PROCWITHERRORS
|
|
14 PROCEDURE procwitherrors;
|
|
15 BEGIN
|
|
16 this demonstrates what error messages
|
|
17 look like;
|
|
18 END;
|
|
19 $Subtitle Procedure HEXVAL
|
|
20 PROCEDURE hexval(ch: char);
|
|
21 BEGIN
|
|
22 write(hexc[ord(ch) div 16], hexc[ord(ch) mod 16])
|
|
23 END;
|
|
24 $SUBtitle M A I N L I N E
|
|
25 BEGIN
|
|
26 hexc:='0123456789ABCDEF';
|
|
27 WHILE true DO
|
|
28 BEGIN
|
|
29 write('Enter real number: '); prompt;
|
|
30 readln(trix.r);
|
|
31 FOR i:=1 to 5 DO
|
|
32 BEGIN
|
|
33 hexval(trix.c[i]);
|
|
34 write(' ');
|
|
35 END;
|
|
36 writeln;
|
|
37 END
|
|
38 END.
|