Autor Beitrag
Arbengie
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 66



BeitragVerfasst: Di 29.12.09 16:42 
Hi hab nun ein neues Problem, bei dem ich nicht weiter weiß:

Code:

ausblenden volle Höhe Delphi-Quelltext
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:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
procedure TForm1.Button3Click(Sender: TObject);
begin

  if (Edit2.Text='0,0083'and (Edit3.Text='Rot'and (Button3.Tag=1then
    begin
    aScore:=strtofloat(Edit1.Text);
    eScore:=aScore+10;
    Edit1.Text:=floattostr(eScore);
    Label14.Caption:='Richtig';
    end
  else
    begin
    Label14.Caption:='Falsch';
    end;
  end;

  if (Edit2.Text='0,1333'and (Edit3.Text='Gruen'and (Button3.Tag=1then
    begin
    aScore:=strtofloat(Edit1.Text);
    eScore:=aScore+10;
    Edit1.Text:=floattostr(eScore);
    Label14.Caption:='Richtig';
    end
  else
    begin
    Label14.Caption:='Falsch';
    end
  end;

  if (Edit2.Text='0,2083'and (Edit3.Text='Schwarz'and (Button3.Tag=1then
    begin
    aScore:=strtofloat(Edit1.Text);
    eScore:=aScore+10;
    Edit1.Text:=floattostr(eScore);
    Label14.Caption:='Richtig';
    end
  else
    begin
    Label14.Caption:='Falsch';
    end
  end;

  if (Edit2.Text='0,075'and (Edit3.Text='Gelb'and (Button3.Tag=1then
    begin
    aScore:=strtofloat(Edit1.Text);
    eScore:=aScore+10;
    Edit1.Text:=floattostr(eScore);
    Label14.Caption:='Richtig';
    end
  else
    begin
    Label14.Caption:='Falsch';
    end
  end;

  if (Edit2.Text='0,0333'and (Edit3.Text='Blau'and (Button3.Tag=1then
    begin
    aScore:=strtofloat(Edit1.Text);

    eScore:=aScore+10;
    Edit1.Text:=floattostr(eScore);
    Label14.Caption:='Richtig';
    end
  else
    begin
    Label14.Caption:='Falsch';
    end
  end;

end;


In der fett gedruckten Zeile zeigt der dann immer an:

[Error] Unit1.pas(289): Declaration expected but 'IF' found

Moderiert von user profile iconGausi: Quote- durch Delphi-Tags ersetzt
Moderiert von user profile iconGausi: B- durch Highlight-Tags ersetzt
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Di 29.12.09 16:44 
ein end; in den 2 zeilen darüber gehört weg. ;)

lg elundril

P.S.: Wir haben hier im Forum extra [delphi][/delphi]-Tags, die deinen Quellcode schöner formatieren als die Code-Tags. ;)

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
Arbengie Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 66



BeitragVerfasst: Di 29.12.09 18:39 
Jo, vielen Dank, hast mirweitergeholfen^^. Und mit den Delphi Tags wollte ich das zuerst auch machen wusste aber nicht wie das geht.

1 Frage noch:

Gibt es auch einen Befehl dafür wenn etwas NICHT erfüllt wird, mit if, then, else usw.?

z.B.:

ausblenden Delphi-Quelltext
1:
 if x [b]not[/b] >1 then ....					
Jann1k
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 866
Erhaltene Danke: 43

Win 7
TurboDelphi, Visual Studio 2010
BeitragVerfasst: Di 29.12.09 19:05 
ausblenden Delphi-Quelltext
1:
2:
if not (bedingung) then 
...
Jakob_Ullmann
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1747
Erhaltene Danke: 15

Win 7, *Ubuntu GNU/Linux*
*Anjuta* (C, C++, Python), Geany (Vala), Lazarus (Pascal), Eclipse (Java)
BeitragVerfasst: Di 29.12.09 20:17 
Oder speziell für dein Beispiel: not x > 1 ist dasselbe wie x <= 1.
platzwart
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1054
Erhaltene Danke: 78

Win 7, Ubuntu 9.10
Delphi 2007 Pro, C++, Qt
BeitragVerfasst: Di 29.12.09 20:28 
user profile iconJakob_Ullmann hat folgendes geschrieben Zum zitierten Posting springen:
Oder speziell für dein Beispiel: not x > 1 ist dasselbe wie x <= 1.


Bezieht sich in diesem Beispiel das not nicht etwa nur auf das x? Müsste das nicht not(x > 1) heißen?

_________________
Wissenschaft schafft Wissenschaft, denn Wissenschaft ist Wissenschaft, die mit Wissen und Schaffen Wissen schafft. (myself)
der organist
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 467
Erhaltene Danke: 17

WIN 7
NQC, Basic, Delphi 2010
BeitragVerfasst: Di 29.12.09 23:44 
jap

_________________
»Gedanken sind mächtiger als Waffen. Wir erlauben es unseren Bürgern nicht, Waffen zu führen - warum sollten wir es ihnen erlauben, selbständig zu denken?« Josef Stalin