Add README.md
[pdp8.git] / sw / src / pascal / DATUM.PS
... / ...
CommitLineData
1PROGRAM DATUM(INPUT,OUTPUT);
2
3 VAR JJ,MM,TT,WT: INTEGER;
4
5
6
7 PROCEDURE LIESDATUM;
8 (*********)
9 VAR STRICH: CHAR;
10 BEGIN
11 READ(JJ, STRICH, MM, STRICH, TT)
12 END (* LIESDATUM *);
13
14
15
16
17 PROCEDURE WOCHENTAG;
18 (*********)
19 VAR F,G: INTEGER;
20 BEGIN
21 IF MM>2 THEN BEGIN
22 F := 1900 + JJ;
23 G := MM + 1
24 END
25 ELSE BEGIN
26 F := 1900 + JJ - 1;
27 G := MM + 13
28 END;
29 WT := ( TRUNC(365.25*F) + TRUNC(30.6*G) + TT - 621049 ) MOD 7
30 END (* WOCHENTAG *);
31
32
33
34
35 PROCEDURE DATUMSTEXT;
36 (**********)
37
38 PROCEDURE WRITEWOCHENTAG;
39 BEGIN
40 CASE WT OF
41 0: WRITE("SONNTAG");
42 1: WRITE("MONTAG");
43 2: WRITE("DIENSTAG");
44 3: WRITE("MITTWOCH");
45 4: WRITE("DONNERSTAG");
46 5: WRITE("FREITAG");
47 6: WRITE("SAMSTAG")
48 END
49 END (* WRITEWOCHENTAG *);
50
51 PROCEDURE WRITEMONAT;
52 BEGIN
53 CASE MM OF
54 1: WRITE("JAENNER");
55 2: WRITE("FEBRUAR");
56 3: WRITE("MAERZ");
57 4: WRITE("APRIL");
58 5: WRITE("MAI");
59 6: WRITE("JUNI");
60 7: WRITE("JULI");
61 8: WRITE("AUGUST");
62 9: WRITE("SEPTEMBER");
63 10: WRITE("OKTOBER");
64 11: WRITE("NOVEMBER");
65 12: WRITE("DEZEMBER")
66 END
67 END (* WRITEMONAT *);
68
69
70 BEGIN
71 WRITE("HEUTE IST ");
72 WRITEWOCHENTAG;
73 WRITE(", DER", TT:3, ". ");
74 WRITEMONAT;
75 WRITELN(1900+JJ:5)
76 END (* DATUMSTEXT *);
77
78
79
80
81BEGIN
82 LIESDATUM;
83 WOCHENTAG;
84 DATUMSTEXT
85END.