Autor Beitrag
Dummfisch
Hält's aus hier
Beiträge: 4



BeitragVerfasst: Fr 02.09.05 16:44 
Hi,

ich habe ein Problem, weil irgendwie habe ich ein Problem mit der repeat-schleife!
Ich möchte aber überprüfen, ob das Ablaufdatum größer ist, als das Geburtsdatum und das um mindestens einen beliebigen Wert...
Vielleicht sieht ja jemand, was ich falsch mache ;-)

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
//Geburtstag generieren, in Variablen schreiben und ausgeben
gebday :=  Format('%.2d', [random(28)+1]);
gebmonth := Format('%.2d', [random(11)+1]);
gebyear := Format('%.2d', [random(84)+15]);

gebdatum := gebyear + gebmonth + gebday;
lbl_gebdate.caption :=  gebday + '.' + gebmonth + '.19' + gebyear;

//Ablaufdatum generieren, in Variablen schreiben und ausgeben
expday :=  Format('%.2d', [random(28)+1]);
expmonth := Format('%.2d', [random(11)+1]);
//Geburtsdatum kleiner als Ablaufdatum???
repeat
  expyear := Format('%.2d', [random(84)+15]);
  until (strtoint(expyear) - strtoint(gebyear)) > 15;

lbl_expdate.caption :=  expday + '.' + expmonth + '.19' + expyear;


Mfg

Moderiert von user profile iconGausi: Code- durch Delphi-Tags ersetzt.
blaueled
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 133

Win XP
D5
BeitragVerfasst: Fr 02.09.05 17:10 
Hallo

Willkommen im DF.
1. Schreibe deinen Code bitte in Delphi-Tags.
2. Formuliere eine klare Frage, am besten mit Fehlermeldung und nicht einfach geht nicht.

Ich habe mal deinen Code ein bisschen verändert, ich weiß aber nicht, ob er
nun macht was du willst, weil du das nicht gesagt hast.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
var  gebday,gebmonth,gebyear,gebdatum,expday,expyear,expmonth : string;
begin
//Geburtstag generieren, in Variablen schreiben und ausgeben

gebday :=  Format('%.2d', [random(28)+1]);
gebmonth := Format('%.2d', [random(11)+1]);
gebyear := Format('%.2d', [random(84)+15]);

gebdatum := gebyear + gebmonth + gebday;
lbl_gebdate.caption :=  gebday + '.' + gebmonth + '.19' + gebyear;

//Ablaufdatum generieren, in Variablen schreiben und ausgeben
expday :=  Format('%.2d', [random(28)+1]);
expmonth := Format('%.2d', [random(11)+1]);
//Geburtsdatum kleiner als Ablaufdatum???
repeat
  expyear := Format('%.2d', [random(84)+15]);
  Application.processmessages;
  until (strtoint(expyear) - strtoint(gebyear)) > 0;

lbl_expdate.caption :=  expday + '.' + expmonth + '.19' + expyear;

Ich weiß nicht, ob es dir so reicht, das Geburtsdatum ist nun immer kleiner als das
Ablaufdatum..
Zitat:
//Geburtsdatum kleiner als Ablaufdatum???


Ich hoffe, es hat geholfen.

Arne