Thema: Delphi ein Lottoprogramm

Einzelnen Beitrag anzeigen

Benutzerbild von MarkL
MarkL

Registriert seit: 1. Mär 2004
7 Beiträge
 
Delphi 6 Enterprise
 
#1

ein Lottoprogramm

  Alt 1. Mär 2004, 17:46
Hallo,
wir haben als Hausaufgabe in Informatik ein Lottoprogramm aufbekommen, das n Lottoziehung simulieren soll. Soweit so gut, das klappt.
Aber am Ende soll auch noch ausgegeben werden, wie oft welche Zahl gezogen wurde und da komm ich nicht weiter. Ich ohffe jemand kann mir helfen.

Bis jetzt sieht es mal so aus:

Delphi-Quellcode:
unit lotto_u;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Label1: TLabel;
    ListBox1: TListBox;
    Button1: TButton;
    ListBox2: TListBox;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var L:ARRAY[1..49] OF integer;
i,j,k,n: integer;
neu: BOOLEAN;
begin
 randomize;
 ListBox1.Clear;
 ListBox2.Clear;
 n:=StrToInt(edit1.text);
 for k:=1 to n do
   begin
        for i:=1 to 6 do
           begin
               repeat
                   neu:=true;
                   L[i]:=Random(49)+1;
                   for j:=1 to i-1 do
                   if L[j] = L[i]
                   then neu:=false;
               until neu = true;
             ListBox1.Items.Add(IntToStr(L[i]));
           end;

   end;


end;

end.
  Mit Zitat antworten Zitat