1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41:
| procedure WochentagBestimmen; var day, month, century, year, ergebnis : Integer; datum, ausgabe : String; begin clrscr; write('Bitte geben sie das gewuenschte Datum ein: '); readln(datum);
day := StrToInt(copy(Datum,1,2)); month := StrToInt(copy(Datum,4,2)); century := StrToInt(copy(Datum,7,2)); year := StrToInt(copy(Datum,9,2));
if month < 3 then begin Dec(year); month := Succ((month + 9) mod 12); end;
ergebnis := (day +((13*month-1)div 5) + year + (year div 4) + (century div 4) -2*century) mod 7;
if ergebnis < 0 then begin Inc(ergebnis, 7); end;
case ergebnis of 0: ausgabe := 'Sonntag'; 1: ausgabe := 'Montag'; 2: ausgabe := 'Dienstag'; 3: ausgabe := 'Mittwoch'; 4: ausgabe := 'Donnerstag'; 5: ausgabe := 'Freitag'; 6: ausgabe := 'Samstag'; end;
write('Das Datum ' +Datum+ ' liegt auf einem ' + ausgabe); readln; end; |