Einzelnen Beitrag anzeigen

ScrollbarKopf

Registriert seit: 17. Okt 2007
154 Beiträge
 
#1

Lotto programm

  Alt 18. Dez 2007, 14:41
Hallo Leute habe jetzt ein Programm das mir aus 45 zahlen 6 zufällige nimmt.
Delphi-Quellcode:
unit 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;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
a,b,c,d,e,f :integer;
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<>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);
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;
end;

end.
Und ich habe folgendes Proplem. Habe jetzt 6 weitere Edits gemacht und möchte das wenn man unten zahlen rein schreibt das delphi die geschriebenen zahlen mit den zufalls zahlen in den anderen edits vergleicht und wenn alle übereinstimmen soll er mitels showmessage sagen das man gewonnen hat und wenn nicht das man verloren hat.
Das Haupt proplem ist ich weiß nciht wie ich es schreiben soll das er die zahlen überprüft also vergleicht.
  Mit Zitat antworten Zitat