Last change
on this file since 1842167 was
f3b67b6,
checked in by Peter A. Buhr <pabuhr@…>, 8 weeks ago
|
update test programs for different program languages
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | program test(Output); |
---|
2 | const Three = 2 + 1; NULL = NIL; PI = 3.14159; Plus = '+'; Fred = 'Fred'; |
---|
3 | type Week = ( Mon, Tue, Wed, Thu, Fri, Sat, Sun ); |
---|
4 | Weekday = Mon..Fri; |
---|
5 | Weekend = Sat..Sun; |
---|
6 | type Count = ( Zero, One, Two, Ten = 10, Eleven ); |
---|
7 | var day : Week; |
---|
8 | wday : Weekday; |
---|
9 | wend : Weekend; |
---|
10 | lunch : array[Week] of Integer; |
---|
11 | cnt : Count; |
---|
12 | begin |
---|
13 | day := Sat; |
---|
14 | wday := day; // invalid but allowed |
---|
15 | wend := day; // valid |
---|
16 | day := Mon; |
---|
17 | wday := day; // valid |
---|
18 | wend := day; // invalid but allowed |
---|
19 | day := wday; // valid |
---|
20 | day := wend; // valid |
---|
21 | if day = wday then |
---|
22 | Writeln( day ); |
---|
23 | if day <= Fri then |
---|
24 | Writeln( 'weekday'); |
---|
25 | case day of |
---|
26 | Mon..Fri : |
---|
27 | Writeln( 'weekday'); |
---|
28 | Sat..Sun : |
---|
29 | Writeln( 'weekend') |
---|
30 | end; |
---|
31 | day := Mon; |
---|
32 | while day <= Sat do begin |
---|
33 | Write( day, ' ' ); |
---|
34 | day := succ( day ); |
---|
35 | end; |
---|
36 | Writeln(); |
---|
37 | for day := Mon to Sat do begin |
---|
38 | Write( day, ' ' ); |
---|
39 | end; |
---|
40 | Writeln(); |
---|
41 | for day := Mon to Sat do |
---|
42 | Write( lunch[day], ' ' ); |
---|
43 | Writeln(); |
---|
44 | for cnt := Zero to Eleven do begin |
---|
45 | Write( ord( cnt ), ' ' ); |
---|
46 | end; |
---|
47 | Writeln(); |
---|
48 | end. |
---|
49 | |
---|
50 | { Local Variables: } |
---|
51 | { tab-width: 4 } |
---|
52 | { pascal-indent-level: 4 } |
---|
53 | { compile-command: "fpc test.pas" } |
---|
54 | { End: } |
---|
Note: See
TracBrowser
for help on using the repository browser.