![]() |
Timer programmieren
:roll:
Ähm Hallo Leute geht um folgendes habe an den Letzten tagen an einer art lotto gearbeitet jetzt möchte ich gerne einen timer programmieren der alle 48 stunden den gewiiner sagt das er gewonnen aht und den verlierern das sie verloren haben wenn man auf den button ziehung drückt soll er die zahlen aufnehmen sagen ok und wenn die zeit aus ist sagen ob man gewoonen hat hier mein Code.
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); edit1.Text := inttostr (a+1); edit2.Text := inttostr (b+1); edit3.Text := inttostr (c+1); edit4.Text := inttostr (d+1); edit5.Text := inttostr (e+1); edit6.Text := inttostr (f+1); richtige :=0; if StrToInt( edit1.text) = StrToInt( edit7.text) then inc (richtige); if StrToInt( Edit2.text) = StrToInt( Edit8.text) then inc (richtige); if StrToInt( Edit3.text) = StrToInt( Edit9.text) then inc (richtige); if StrToInt( Edit4.text) = StrToInt( Edit10.text) then inc (richtige); if StrToInt( Edit5.text) = StrToInt( Edit11.text) then inc (richtige); if StrToInt( Edit6.text) = StrToInt( Edit12.text) then inc (richtige); if richtige = 6 then showmessage ('Sie haben Gewonnen'); 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'); end; |
Re: Timer programmieren
Am Besten als geplanten Task in Windows anlegen
|
Re: Timer programmieren
Gut. Dann viel Erfolg. :thumb:
Oder hast etwa ne Frage?? Konnte nämlich keine finden :gruebel: |
Re: Timer programmieren
ja habe ne frage habe null ahnung wie ich das machen soll mit dem timer
|
Re: Timer programmieren
Ein Timer über 48 stunden ist nicht optimal. Sorge dafür das dein Programm in diesem Intervall gestartet wird: "Geplanter Task"
|
Re: Timer programmieren
... oder du nimmst 'ne Variable des Typs TDateTime, speicherst mit Now den Zeitpunkt der letzten Ausführung darin und in einem Timer (der vlt. auf 10sek oder so steht) prüfst du die Variable mit Now gegen. Wenn (Variable + 2) >= Now sind 48h vergangen.
Delphi-Quellcode:
*schauder* :mrgreen:
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); ... Dafür hat man dir hier auch schon bessere Lösungen vorgeschlagen. |
Re: Timer programmieren
wegen der 48 Stunden:
Timer ist blöd, weil dann müßte man den Rechner ja die ganzen 48 Stunden an lassen :shock: 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 :stupid:
Delphi-Quellcode:
da wird einiges mehrfach ausgewertet.
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); (a<>b) = (b<>a) das Rote ist doppelt:
Code:
man hat also nur verloren, wenn man alle 6 falsch hat?
[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];
Delphi-Quellcode:
wie wäre es z.B. so?
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');
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');
Delphi-Quellcode:
oder gleich zusammen
if richtige < 6 then showmessage ('Sie haben leider verloren');
Delphi-Quellcode:
oder ohne Zählvariable:
if richtige = 6 then showmessage ('Sie haben Gewonnen')
else showmessage ('Sie haben leider verloren');
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; |
Re: Timer programmieren
himitsu danke für die ideen wegen dem doppelt schreiben ich werde es weg löschen das überflüßige mit deinen beispiel meinst du das man ur verloren hat wenn man alle falsch hat und das wenn man 3 falsch hat mit 3 punkten gewonnen hat oder
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
begin randomize; repeat a:= random (46); b:= random (46); c:= random (46); d:= random (46); e:= random (46); f:= random (46); until(a<>b) and (a<>c) and (a<>d) and (a<>e) and (a<>f) and (b<>c) and (b<>d) and (b<>e) and (b<>f) and (c<>d) and (c<>e) and (c<>f) and (d<>e) and (d<>f) and (e<>f); edit1.Text := inttostr (a+1); edit2.Text := inttostr (b+1); edit3.Text := inttostr (c+1); edit4.Text := inttostr (d+1); edit5.Text := inttostr (e+1); edit6.Text := inttostr (f+1); richtige :=0; if StrToInt( edit1.text) = StrToInt( edit7.text) then inc (richtige); if StrToInt( Edit2.text) = StrToInt( Edit8.text) then inc (richtige); if StrToInt( Edit3.text) = StrToInt( Edit9.text) then inc (richtige); if StrToInt( Edit4.text) = StrToInt( Edit10.text) then inc (richtige); if StrToInt( Edit5.text) = StrToInt( Edit11.text) then inc (richtige); if StrToInt( Edit6.text) = StrToInt( Edit12.text) then inc (richtige); if richtige = 6 then showmessage ('Sie haben Gewonnen'); 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'); end; procedure TForm1.Button2Click(Sender: TObject); begin close; end; procedure TForm1.Button3Click(Sender: TObject); begin edit1.clear; edit2.clear; edit3.clear; edit4.clear; edit5.clear; edit6.clear; edit7.clear; edit8.clear; edit9.clear; edit10.clear; edit11.clear; edit12.clear; end; end. |
Re: Timer programmieren
OT: ich hatte dir doch eine so schoene Funktion gemacht, fuer das errechnen von 6 unique Zufallszahlen... :cry: Ich bin beledigit, dass du die nicht verwendest :cry:
|
Re: Timer programmieren
Kannst die Funktion bitte noaml schreiben kann sein das ich das nciht mitbekommen ahbe
|
Re: Timer programmieren
In
![]() |
Re: Timer programmieren
dieses wird nur angezeigt wenn alle 6 richtig sind
Delphi-Quellcode:
und dieses nur wen alle 6 falsch sind.
if richtige = 6 then showmessage ('Sie haben Gewonnen');
Delphi-Quellcode:
bei 1 bis 5 Falschen/Richtigen wird nichts angezeigt :stupid:
if falsche = 6 then showmessage ('Sie haben leider verloren');
|
Re: Timer programmieren
Stimmt, wurde aber auch schon erwähnt, glaube ich ;)
|
Re: Timer programmieren
himitsu das bringt sich aber nix er soll ja anzeigen wenn man 1-5 falsche hat das man verloren hat
|
Re: Timer programmieren
Das ist in Deinem Source aber nicht so.
|
Re: Timer programmieren
doch ahb ich doch geschrieben
Delphi-Quellcode:
it Unit1;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Edit1: TEdit; Edit2: TEdit; Edit3: TEdit; Edit4: TEdit; Edit5: TEdit; Edit6: TEdit; Button1: TButton; Button2: TButton; Button3: TButton; Edit7: TEdit; Edit8: TEdit; Edit9: TEdit; Edit10: TEdit; Edit11: TEdit; Edit12: TEdit; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); private { Private-Deklarationen } public { Public-Deklarationen } end; var Form1: TForm1; a,b,c,d,e,f :integer; richtige: integer; falsche: integer; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin randomize; repeat a:= random (46); b:= random (46); c:= random (46); d:= random (46); e:= random (46); f:= random (46); until(a<>b) and (a<>c) and (a<>d) and (a<>e) and (a<>f) and (b<>c) and (b<>d) and (b<>e) and (b<>f) and (c<>d) and (c<>e) and (c<>f) and (d<>e) and (d<>f) and (e<>f); edit1.Text := inttostr (a+1); edit2.Text := inttostr (b+1); edit3.Text := inttostr (c+1); edit4.Text := inttostr (d+1); edit5.Text := inttostr (e+1); edit6.Text := inttostr (f+1); richtige :=0; if StrToInt( edit1.text) = StrToInt( edit7.text) then inc (richtige); if StrToInt( Edit2.text) = StrToInt( Edit8.text) then inc (richtige); if StrToInt( Edit3.text) = StrToInt( Edit9.text) then inc (richtige); if StrToInt( Edit4.text) = StrToInt( Edit10.text) then inc (richtige); if StrToInt( Edit5.text) = StrToInt( Edit11.text) then inc (richtige); if StrToInt( Edit6.text) = StrToInt( Edit12.text) then inc (richtige); if richtige = 6 then showmessage ('Sie haben Gewonnen'); 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'); end; procedure TForm1.Button2Click(Sender: TObject); begin close; end; procedure TForm1.Button3Click(Sender: TObject); begin edit1.clear; edit2.clear; edit3.clear; edit4.clear; edit5.clear; edit6.clear; edit7.clear; edit8.clear; edit9.clear; edit10.clear; edit11.clear; edit12.clear; end; end |
Re: Timer programmieren
Anstatt auf Gleichheit kannst auch Größer als prüfen. ;-)
Und hör auf, jedesmal Deinen Source zu posten... |
Re: Timer programmieren
Ich weiß ent was ihr alle meint ich sage doch das er sagt wenn alle 6 richtig sind soll er sagen gewoonnnen und wenn nur eins falsch ist soll er sagen das man verloren aht
|
Re: Timer programmieren
Delphi-Quellcode:
Ist kürzer und richtiger.
richtige :=0;
if StrToInt( edit1.text) = StrToInt( edit7.text) then inc (richtige); if StrToInt( Edit2.text) = StrToInt( Edit8.text) then inc (richtige); if StrToInt( Edit3.text) = StrToInt( Edit9.text) then inc (richtige); if StrToInt( Edit4.text) = StrToInt( Edit10.text) then inc (richtige); if StrToInt( Edit5.text) = StrToInt( Edit11.text) then inc (richtige); if StrToInt( Edit6.text) = StrToInt( Edit12.text) then inc (richtige); if richtige = 6 then showmessage ('Sie haben Gewonnen') else showmessage ('Sie haben leider verloren'); Zitat:
|
Re: Timer programmieren
Hat geklabt mit der verkürzten version danke und das mit den source werd ich mir merken :-D
|
Re: Timer programmieren
das falsche = 6 aus deinem Code zeigte die Falsch-Meldung nur bei genau 6 falschen Zahlen an :zwinker:
Das in #12 ist dein Code (nur die Vergleichabfragen) In Beitrag #7 und auch nochmal eines davon in der #19 macht es richtigz |
Re: Timer programmieren
OK danke eine Frage ncoh wei kann man sein delphi programm verpacken so das man nur iene datei braucht um es zu öffnen also wenn amn jemanden das programm geben will der kein delphi hat
|
Re: Timer programmieren
Ihm die Exe-Datei schicken? :lol:
|
Re: Timer programmieren
Beim Kompilieren kommt ne *.exe raus, die musst Du weitergeben.
|
Re: Timer programmieren
bracuht man nur die exe datei ja und ne 2 frage kann man das symbol dieser datei ändern wenn ja wo bekommt symbole her
|
Re: Timer programmieren
Schneller Detlef, schneller :mrgreen:
Ja, kann man in den Projektoptionen ändern. Wo man die her bekommt: ![]() |
Re: Timer programmieren
In den Projektoptionen kannst Du ein neues Icon vergeben. Das kannst Du mit dem Bildeditor etc. selbst erstellen.
@Manuel :P |
Re: Timer programmieren
Danke Dörte
Heiße Marc und net Detlef |
Re: Timer programmieren
Danke Manuel
|
Re: Timer programmieren
Zitat:
|
Re: Timer programmieren
Ok sorry Inere Gedanken Des san immer die ausreden :-)
|
Re: Timer programmieren
Ich hab kein Wort verstanden :gruebel:
|
Re: Timer programmieren
Zitat:
|
Re: Timer programmieren
bast schon egal jetzt.
Ok habe symbole und wie kann ich das Symbol jetzt ändern von dem Programm |
Re: Timer programmieren
Zitat:
Zitat:
Und das Problem findet sich auch in der ![]() |
Re: Timer programmieren
Liste der Anhänge anzeigen (Anzahl: 1)
Hier
|
Re: Timer programmieren
wie komme ich zu den projektoptionen finde das net
|
Re: Timer programmieren
Projekt -> Optionen im Hauptmenü (zumindest unter Delphi 7).
|
Re: Timer programmieren
Habs gfunden sieht bei turbo delphi total anders aus
|
Re: Timer programmieren
Ich kann ja nicht wissen, dass Du TD benutzt.
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 23:30 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz