AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

6 aus 49 will nicht so richtig

Ein Thema von funkuchn · begonnen am 20. Sep 2009 · letzter Beitrag vom 19. Okt 2011
Antwort Antwort
Benutzerbild von Wolfgang Mix
Wolfgang Mix

Registriert seit: 13. Mai 2009
Ort: Lübeck
1.222 Beiträge
 
Delphi 2005 Personal
 
#1

Re: 6 aus 49 will nicht so richtig

  Alt 20. Sep 2009, 15:58
Folgendes legt im Array Lotto erst einmal alle 49 Zahlen von 1..49 ab.
Dann ziehst Du eine Zahl (z.B. 26) und setzt an der Stelle Lotto[26] eine 0;
Das ganze machst Du 6x und suchst am Ende nach den Nullen im Lotto-Array.
Ich hoffe, Du kommst jetzt weiter, wenn nicht, wieder melden.

Gruß

Wolfgang

Delphi-Quellcode:
var
  Form1: TForm1;
  lotto: array[1..49] of word;
  lotto2: array[1..6] of integer;
  sorted: array[1..6] of word;
  i,j:integer;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  randomize;
end;

procedure TForm1.Button1Click(Sender: TObject);
var i,zaehler,temp:integer;
begin
  //Listbox1.Clear;
  zaehler:=0;
  for i:=1 to 49 do lotto[i]:=i;
  //edit1.Text:=inttostr(lotto[34]); //Nur Test
  while zaehler<6 do
  begin
     temp:=random(49)+1;
     while lotto[temp]=0 do
     begin
       temp:=random(49)+1;
     end;
        lotto[temp]:=0;
        inc(zaehler);
        Listbox1.Items.Add(Inttostr(temp));
        lotto2[zaehler]:=temp;
     //Edit1.Text:=Listbox1.items.text[1]+Listbox1.items.text[2]
  end;
  Edit1.Text:=IntToStr(lotto2[1]);
  Edit2.Text:=IntToStr(lotto2[2]);
  Edit3.Text:=IntToStr(lotto2[3]);
  Edit4.Text:=IntToStr(lotto2[4]);
  Edit5.Text:=IntToStr(lotto2[5]);
  Edit6.Text:=IntToStr(lotto2[6]);

end;
Wolfgang Mix
if you can't explain it simply you don't understand it well enough - A. Einstein
Mein Baby:http://www.epubli.de/shop/buch/Grund...41818516/52824
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:13 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 by Thomas Breitkreuz