Autor Beitrag
MJ87
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21

Win XP
D5 Pro
BeitragVerfasst: Sa 03.09.05 14:21 
Hallo,

ich bin einen Taschenrechner mit Punkt vor Strichrechnung am Programmieren, habe jetzt aber das Problem das Delphi mir immer sagt, dass ich zu viele Paramter habe

ausblenden Delphi-Quelltext
1:
2:
3:
4:
var
  Form1: TForm1;
  modus,modusvorher: Integer;
  Ergebnis,Ergebnisvorher: real;


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
procedure TForm1.Button1Click(Sender: TObject);
begin
If Modus<3 then
  begin
    Ergebnis:=Rechne(Ergebnis,StrToInt(Feld.text),Modus);
  end
else
  begin
    Ergebnis:=Rechne(Ergebnis,StrToInt(Feld.text),Modus);
    Ergebnis:=Rechne(Ergebnisvorher,Ergebniss,Modusvorher);
    Modusvorher:=0;
    Ergebnisvorher:=0;
  end;
Feld.text:=FloatToStr(Ergebniss);
Modus:=1;
end;


Die Fehlermeldung kommt in Zeile 5.
Kann mir jemand sagen was der Fehler ist???

Danke MJ87

Moderiert von user profile iconGausi: Code- durch Delphi-Tags ersetzt.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Sa 03.09.05 14:24 
Wie sieht denn die Funktion Rechne aus?

_________________
We are, we were and will not be.
MJ87 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21

Win XP
D5 Pro
BeitragVerfasst: Sa 03.09.05 14:31 
Die Function Rechne sieht so aus:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
function Rechne(a,b: Real; M:Integer):Real;
begin
case M of
  1: Result:=a+b;
  2: Result:=a-b;
  3: Result:=a*b;
  4: Result:=a/b;
  else Result:=b;
end;
end;


MJ87

Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt.
MJ87 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21

Win XP
D5 Pro
BeitragVerfasst: Sa 03.09.05 15:02 
Mein Problem hat sich erledigt, habe den Fehler doch gefunden.

Danke MJ87
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Sa 03.09.05 15:02 
Schau mal da:
ausblenden Delphi-Quelltext
1:
Rechne(Ergebnis,StrToInt(Feld.text),Modus)					

und da:
ausblenden Delphi-Quelltext
1:
function Rechne(a,b: Real; M:Integer):Real;					

_________________
We are, we were and will not be.
uall@ogc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: Sa 03.09.05 15:18 
@Gausi wäre mir neu wenn delphi das nicht könnte, umgekehrt gehts nicht aber nen real kann man immer nem integer zuweisen

_________________
wer andern eine grube gräbt hat ein grubengrabgerät
- oder einfach zu viel zeit