Autor Beitrag
Ari
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 29



BeitragVerfasst: Mo 15.12.03 13:42 
Wie kann ich eine Zahl zwischen 1 und 100 erzeugen ?

"In der Prozedur ZahlErzeugen wird die Variable zahl mit einem Wert zwischen 1 und 1000 belegt."
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Mo 15.12.03 13:52 
Schau dir mal in der Delphi-Hilfe die Befehle Randomize und Random an...

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
K_Dadis
Hält's aus hier
Beiträge: 6



BeitragVerfasst: Mo 15.12.03 14:01 
weiß nicht genau, ob ich dich richtig verstehe, aber um eine Zufallszahl zwischen 1 und 100 zu erzeugen mache folgendes:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
Var
zahl:integer;

Begin
randomize;    //muß aufgerufen werden, aber nur einmal im prog.
zahl:=random(100)+1;
end.

Wenn du Dezimalzahlen brauchst dann:

Var
zahl:real;

Begin
randomize; 
zahl:=random+random(100)+1;
end.


Moderiert von user profile iconMotzi: Delphi-Tags hinzugefügt.
Ari Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 29



BeitragVerfasst: Mo 15.12.03 14:05 
aah... ok danke