Autor Beitrag
Dee-M-Cee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 24



BeitragVerfasst: Do 19.01.06 14:01 
Hallo.
Ich hab in meinem Programm eine Funktion zur Ermittlung des Wochentages aus einem Datum.
Dazu benutze ich Zellers Kongruenzverfahren: -> Zellers Kongruenz

Jedoch erhalte ich in meiner Funktion einen Compilerfehler.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
function TForm_Haupt.Wochentag(iJahr,iMonat,iTag: extended):extended; //Zellers Kongruenz
 var iJahrhundert,iJahreszahl: extended;
begin
 iJahrhundert:=StrToFloat(copy(FloatToStr(iJahr),0,2));
 iJahreszahl:=StrToFloat(copy(FloatToStr(iJahr),3,2));

 result:=(iTag + floor((iMonat+1)*2.6) + iJahreszahl + floor(iJahreszahl / 4) + floor(iJahrhundert / 4) - 2*iJahrhundert) mod 7;
end;


ausblenden Quelltext
1:
[Error] Unit1.pas(103): E2015 Operator not applicable to this operand type					


Was läuft da schief, bzw wo ist mein Fehler?
Bruder Lal
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 31

WIN XP
Delphi 2005
BeitragVerfasst: Do 19.01.06 18:46 
ich fürchte, dein Fehler ist das mod. Die Delphihilfe hätte dazu gesagt, dass modulo absolute Ganzzahlen erwartet und absolute Ganzzahlen liefert.
Dee-M-Cee Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 24



BeitragVerfasst: Do 19.01.06 21:14 
user profile iconBruder Lal hat folgendes geschrieben:
ich fürchte, dein Fehler ist das mod. Die Delphihilfe hätte dazu gesagt, dass modulo absolute Ganzzahlen erwartet und absolute Ganzzahlen liefert.

Und wie kann ich das ändern?
Wenn ich das ganze in int() packe klappts auch nicht.
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Do 19.01.06 21:20 
Verwende Round oder Trunc

AXMD