Einzelnen Beitrag anzeigen

Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
43.167 Beiträge
 
Delphi 12 Athens
 
#7

Re: Timer programmieren

  Alt 19. Dez 2007, 16:52
wegen der 48 Stunden:
Timer ist blöd, weil dann müßte man den Rechner ja die ganzen 48 Stunden an lassen

Da klingt die Idee von mkinzler schon besser.


10 Sekunden? ... nja, bei 2 Tagen Laufzeit reicht doch auch 60 Sekunden ... auf die Sekunde kommt es doch bestimmt nicht an.


jupp schauder und doppelgemoppelt
Delphi-Quellcode:
until (a<>b) and (a<>c) and (a<>d) and (a<>e) and (a<>f)
and (b<>a) and (b<>c) and (b<>d) and (b<>e) and (b<>f)
and (c<>a) and (c<>b) and (c<>d) and (c<>d) and (c<>f)
and (d<>a) and (d<>b) and (d<>c) and (d<>e) and (d<>f)
and (e<>a) and (e<>b) and (e<>c) and (e<>d) and (e<>f)
and (f<>a) and (f<>b) and (f<>c) and (f<>d) and (f<>e);
da wird einiges mehrfach ausgewertet.
(a<>b) = (b<>a)
das Rote ist doppelt:
Code:
[color=gray]... hier fehlt wohl was[/color]
until (a<>b) and (a<>c) and (a<>d) and (a<>e) and (a<>f)
and  [color=red](b<>a)[/color] and (b<>c) and (b<>d) and (b<>e) and (b<>f)
and  [color=red](c<>a) and (c<>b)[/color] and (c<>d) and (c<>d) and (c<>f)
and  [color=red](d<>a) and (d<>b) and (d<>c)[/color] and (d<>e) and (d<>f)
and  [color=red](e<>a) and (e<>b) and (e<>c) and (e<>d)[/color] and (e<>f)
and  [color=red](f<>a) and (f<>b) and (f<>c) and (f<>d) and (f<>e)[/color];
man hat also nur verloren, wenn man alle 6 falsch hat?
Delphi-Quellcode:
falsche :=0;
if StrToInt( Edit1.text) <> StrToInt( Edit7.text) then inc (falsche);
if StrToInt( Edit2.text) <> StrToInt( Edit8.text) then inc (falsche);
if StrToInt( Edit3.text) <> StrToInt( Edit9.text) then inc (falsche);
if StrToInt( Edit4.text) <> StrToInt( Edit10.text) then inc (falsche);
if StrToInt( Edit5.text) <> StrToInt( Edit11.text) then inc (falsche);
if StrToInt( Edit6.text) <> StrToInt( Edit12.text) then inc (falsche);

if falsche =6 then showmessage ('Sie haben leider verloren');
wie wäre es z.B. so?
Delphi-Quellcode:
falsche :=0;
if StrToInt( Edit1.text) <> StrToInt( Edit7.text) then inc (falsche);
if StrToInt( Edit2.text) <> StrToInt( Edit8.text) then inc (falsche);
if StrToInt( Edit3.text) <> StrToInt( Edit9.text) then inc (falsche);
if StrToInt( Edit4.text) <> StrToInt( Edit10.text) then inc (falsche);
if StrToInt( Edit5.text) <> StrToInt( Edit11.text) then inc (falsche);
if StrToInt( Edit6.text) <> StrToInt( Edit12.text) then inc (falsche);

if falsche > 0 then showmessage ('Sie haben leider verloren');
Delphi-Quellcode:
falsche := 6 - richtige;
if falsche > 0 then showmessage ('Sie haben leider verloren');
if richtige < 6 then showmessage ('Sie haben leider verloren'); oder gleich zusammen
Delphi-Quellcode:
if richtige = 6 then showmessage ('Sie haben Gewonnen')
else showmessage ('Sie haben leider verloren');
oder ohne Zählvariable:
Delphi-Quellcode:
if (StrToInt(Edit1.text) = StrToInt(Edit7.text))
  and (StrToInt(Edit2.text) = StrToInt(Edit8.text))
  and (StrToInt(Edit3.text) = StrToInt(Edit9.text))
  and (StrToInt(Edit4.text) = StrToInt(Edit10.text))
  and (StrToInt(Edit5.text) = StrToInt(Edit11.text))
  and (StrToInt(Edit6.text) = StrToInt(Edit12.text)) then
begin
  showmessage ('Sie haben Gewonnen');
end else begin
  showmessage ('Sie haben leider verloren');
end;
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests
  Mit Zitat antworten Zitat