Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Brauche Hilfe bei roulettespiel, (feld-inhalt x3 + Geldfeld) (https://www.delphipraxis.net/84280-brauche-hilfe-bei-roulettespiel-feld-inhalt-x3-geldfeld.html)

Hansdieter 14. Jan 2007 18:12


Brauche Hilfe bei roulettespiel, (feld-inhalt x3 + Geldfeld)
 
also wenn man die zahl 1-12trifft, dann soll der betrag in dem entsprechendem feld(first) x3 genommen werden und zu einem (money)editfeld hinzugefügt werden.



ich kriegs irgendwie net hin... könnt ihr mir helfen?
Delphi-Quellcode:
money.Text:=strtofloat(floattostr(money)+((floattostr(first))*3));
first.text:='0';

der fehler "[Fehler] Unit4.pas(82): E2250 Es gibt keine überladene Version von 'FloatToStr', die man mit diesen Argumenten aufrufen kann"

mkinzler 14. Jan 2007 18:20

Re: Brauche Hilfe bei roulettespiel, (feld-inhalt x3 + Geldf
 
Was für ein Typ haben money und first? Es muß money.Text o.ä. heißen.

Hansdieter 14. Jan 2007 18:51

Re: Brauche Hilfe bei roulettespiel, (feld-inhalt x3 + Geldf
 
Delphi-Quellcode:
procedure TForm4.LOSClick(Sender: TObject);
var GELD, y : integer;
begin
ZAHL.caption:=floattostr(int(random*36));
y:=floattostr(ZAHL.caption);
IF (y>0) AND (y<13)
THEN
BEGIN
money.Text:=strtofloat(floattostr(money.text)+((floattostr(first.caption))*3));
first.text:='0';
hm hier is alles was ich hab aber das stimmt hinten und vorne nicht :oops:

mkinzler 14. Jan 2007 18:54

Re: Brauche Hilfe bei roulettespiel, (feld-inhalt x3 + Geldf
 
Was für einen Typ haben jetzt money und first?
Tedit?, TLabel?
Außerdem hast du die Funktionen vertauscht:

Delphi-Quellcode:
money.Text:=FloatToStr(StrToFloat(money.text)+((StrToFloat(first.caption))*3));

Hansdieter 14. Jan 2007 19:09

Re: Brauche Hilfe bei roulettespiel, (feld-inhalt x3 + Geldf
 
danke :-D das kalppt jetzt und das mit edit und label hatte ich verwechselt aber dies klappt nun auch...

was noch nicht geht ist der teil hier:
Delphi-Quellcode:
ZAHL.caption:=floattostr(int(random*36));
y:=floattostr(ZAHL.caption);
ich will eine zufallszahl erstellen mit 36zahlen erstellen und diese ist halt als variable notwendig und soll auch angezeigt werden (label "Zahl")

mkinzler 14. Jan 2007 19:12

Re: Brauche Hilfe bei roulettespiel, (feld-inhalt x3 + Geldf
 
Delphi-Quellcode:
ZAHL.caption:=IntToStr(int(random*36));
y:=StrToFloat(ZAHL.caption);

Hansdieter 14. Jan 2007 19:24

Re: Brauche Hilfe bei roulettespiel, (feld-inhalt x3 + Geldf
 
hat sich erledigt

mkinzler 14. Jan 2007 19:46

Re: Brauche Hilfe bei roulettespiel, (feld-inhalt x3 + Geldf
 
Delphi-Quellcode:
ZAHL.caption:=IntToStr(Trunc(random*36));
Delphi-Quellcode:
y:=StrToInt(ZAHL.caption);
oder y als Extended deklarieren

Hansdieter 14. Jan 2007 20:05

Re: Brauche Hilfe bei roulettespiel, (feld-inhalt x3 + Geldf
 
Delphi-Quellcode:
ZAHL.caption:=floatToStr(int(random*36));
y:=StrToint(ZAHL.caption);
so hatte ichs jetzt gemacht



was aber nicht klappt ist die else abfrage :(
Delphi-Quellcode:
begin
ZAHL.caption:=floatToStr(int(random*36));
y:=StrToint(ZAHL.caption);
 IF (y>0) AND (y<13) THEN
  money.Text:=FloatToStr(StrToFloat(money.text)+((StrToFloat(first.text))*3));
  first.text:='0';
 ELSE   money.Text:=FloatToStr(StrToFloat(money.text)-(StrToFloat(first.text));
    first.text:='0';
end;

Nils_13 14. Jan 2007 20:10

Re: Brauche Hilfe bei roulettespiel, (feld-inhalt x3 + Geldf
 
Ohne mir diesen Code großartig angeschaut zu haben, ist mir aufgefallen, dass du begin und end; vergessen hast. Das muss so aussehen:
Delphi-Quellcode:
begin
  zahl.Caption := FloatToStr(int(random*36));
  y := StrToint(zahl.Caption);
  if (y > 0) and (y < 13) then
  begin
    money.Text := FloatToStr(StrToFloat(money.text)+((StrToFloat(first.text))*3));
    first.text := '0';
  end else
  begin
    money.Text := FloatToStr(StrToFloat(money.text)-(StrToFloat(first.text));
    first.text := '0';
  end;
end;
Aber wie schon gesagt: ich habe ihn mir wirklich nicht großartig angeschaut, mir ist nur diese Sache aufgefallen, ich hoffe, ich konnte helfen, wenn nicht, dann sry.


Alle Zeitangaben in WEZ +1. Es ist jetzt 23:23 Uhr.
Seite 1 von 2  1 2      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz