• Web sitemizin içeriğine ve tüm hizmetlerimize erişim sağlamak için Web sitemize kayıt olmalı ya da giriş yapmalısınız. Web sitemize üye olmak tamamen ücretsizdir.
  • Sohbetokey.com ile canlı okey oynamaya ne dersin? Hem sohbet et, hem mobil okey oyna!
  • Soru mu? Sorun mu? ''Bir Sorum Var?'' sistemimiz aktiftir. Paylaşın beraber çözüm üretelim.

Sayısal Loto

Üyelik Tarihi
7 Ocak 2015
Konular
4,091
Mesajlar
4,274
MFC Puanı
40
Kod:
Unit Unit1;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls, Buttons, ExtCtrls;typeTForm1 = class(TForm)Edit1: TEdit;Label1: TLabel;ListBox1: TListBox;Edit2: TEdit;Label2: TLabel;Label3: TLabel;Label4: TLabel;Label5: TLabel;Label6: TLabel;Label7: TLabel;Label8: TLabel;Label9: TLabel;Label10: TLabel;Label11: TLabel;Label12: TLabel;Label13: TLabel;Label14: TLabel;Timer1: TTimer;SpeedButton1: TSpeedButton;SpeedButton2: TSpeedButton;Timer2: TTimer;Label15: TLabel;Label16: TLabel;procedure FormCreate(Sender: TObject);procedure Timer1Timer(Sender: TObject);procedure SpeedButton1Click(Sender: TObject);procedure SpeedButton2Click(Sender: TObject);procedure Timer2Timer(Sender: TObject);procedure Label15Click(Sender: TObject);procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);procedure Label15MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);procedure Label15MouseDown(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);private{ Private declarations }public{ Public declarations }end;varForm1: TForm1;a:array[1..6] of integer;//Çekiliş dizisib:array[1..6] of integer;//Kolonlar dizisisayac,seffaf:integer;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);beginAlphaBlend:=true;end;procedure TForm1.Timer1Timer(Sender: TObject);beginseffaf:=seffaf+5;AlphaBlendValue:=seffaf;if seffaf=255 thentimer1.Enabled:=false;end;procedure TForm1.SpeedButton1Click(Sender: TObject);vari,j,deger:integer;beginrandomize;//Bilgisayar, program açıldığında aynı rakamları ele almasın diye.a[1]:=random(49)+1;//Çekiliş dizisine 1-49 arasında 6 farklı rakam atanıyor.a[2]:=random(49)+1;a[3]:=random(49)+1;a[4]:=random(49)+1;a[5]:=random(49)+1;a[6]:=random(49)+1;for i:=1 to 6 dofor j:=i+1 to 6 doif a[i]=a[j] then a[i]:=a[i]+1;//Eğer bilgisayar rasgele aynı rakamlar tutar ise o rakamı bir arttır.for i:=1 to 6 dofor j:=i+1 to 6 doif a[i]>a[j] then//Sıralama algoritması.begindeger:=a[i];a[i]:=a[j];a[j]:=deger;end;edit1.Text:=inttostr(a[1])+? ?+inttostr(a[2])+? ?+inttostr(a[3])+? ?+inttostr(a[4])+? ?+inttostr(a[5])+? ?+inttostr(a[6]);//Çekiliş rakamları edit bileşenine yazdırılıyor.end;procedure TForm1.SpeedButton2Click(Sender: TObject);vari,j,deger,k:integer;beginlistbox1.Clear;//Önceden yazdırılan kolonlar bir daha listbox?da görünmesin.label9.Caption:=?0?;label10.Caption:=?0?;label11.Caption:=?0?;label12.Caption:=?0?;label13.Caption:=?0?;label14.Caption:=?0?;for k:=1 to strtoint(edit2.text) do//Belirtilen kolon sayısına göre dön.beginListBox1.*******;//Listbox?ı yenile, gözle görmemizi sağlar.label9.*******;label10.*******;label11.*******;label12.*******;label13.*******;label14.*******;randomize;b[1]:=random(49)+1;//Kolonlar dizisine 1-49 arasında 6 farklı rakamlar atanıyor.b[2]:=random(49)+1;b[3]:=random(49)+1;b[4]:=random(49)+1;b[5]:=random(49)+1;b[6]:=random(49)+1;for i:=1 to 6 dofor j:=i+1 to 6 doif b[i]=b[j] then b[i]:=b[i]+1;//Kolondaki sayılardan biri eşit ise bir arttır.for i:=1 to 6 dofor j:=i+1 to 6 doif b[i]>b[j] then//Sıralama algoritması.begindeger:=b[i];b[i]:=b[j];b[j]:=deger;end;for i:=1 to 6 dofor j:=1 to 6 doif a[i]=b[j] then sayac:=sayac+1;//Çekiliş rakamları Kolonlar rakamlarından birine eşit ise sayacımızı bir arttır.if sayac=1 then begin label9.Caption:=inttostr(strtoint(label9.Caption)+1); sayac:=0; end;//Eğer sayaç bir ise o kolonda bir tutturmuştur.if sayac=2 then begin label10.Caption:=inttostr(strtoint(label10.Caption)+1); sayac:=0; end;if sayac=3 then begin label11.Caption:=inttostr(strtoint(label11.Caption)+1); sayac:=0; end;if sayac=4 then begin label12.Caption:=inttostr(strtoint(label12.Caption)+1); sayac:=0; end;if sayac=5 then begin label13.Caption:=inttostr(strtoint(label13.Caption)+1); sayac:=0; end;if sayac=6 then begin label14.Caption:=inttostr(strtoint(label14.Caption)+1); sayac:=0; end;ListBox1.Items.Add(inttostr(k)+? ? ?+inttostr(b[1])+? ?+inttostr(b[2])+? ?+inttostr(b[3])+? ?+inttostr(b[4])+? ?+inttostr(b[5])+? ?+inttostr(b[6]));//Kolonlarımız listbox bileşinine yazdırılıyor.end;end;//Alt satırda bulunan kod kısımları tamamen görselliğe dayalıdır.procedure TForm1.Timer2Timer(Sender: TObject);beginseffaf:=seffaf-5;AlphaBlendValue:=seffaf;if seffaf=0 thenbegintimer1.Enabled:=false;halt;end;end;procedure TForm1.Label15Click(Sender: TObject);begintimer2.Enabled:=true;end;procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);beginlabel15.Font.Color:=clred;end;procedure TForm1.Label15MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);beginlabel15.Font.Color:=$006C6CFF;end;procedure TForm1.Label15MouseDown(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);beginlabel15.Font.Color:=$000000B0;end;end.Unit Unit1;  interface  uses  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons, ExtCtrls;  type TForm1 = class(TForm) Edit1: TEdit; Label1: TLabel; ListBox1: TListBox; Edit2: TEdit; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; Label7: TLabel; Label8: TLabel; Label9: TLabel; Label10: TLabel; Label11: TLabel; Label12: TLabel; Label13: TLabel; Label14: TLabel; Timer1: TTimer; SpeedButton1: TSpeedButton; SpeedButton2: TSpeedButton; Timer2: TTimer; Label15: TLabel; Label16: TLabel; procedure FormCreate(Sender: TObject); procedure Timer1Timer(Sender: TObject); procedure SpeedButton1Click(Sender: TObject); procedure SpeedButton2Click(Sender: TObject); procedure Timer2Timer(Sender: TObject); procedure Label15Click(Sender: TObject); procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure Label15MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure Label15MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); private { Private declarations } public { Public declarations } end; var  Form1: TForm1; a:array[1..6] of integer;//Çekiliş dizisi b:array[1..6] of integer;//Kolonlar dizisi sayac,seffaf:integer;  implementation  {$R *.dfm}  procedure TForm1.FormCreate(Sender: TObject); begin AlphaBlend:=true; end;  procedure TForm1.Timer1Timer(Sender: TObject); begin seffaf:=seffaf+5; AlphaBlendValue:=seffaf; if seffaf=255 then timer1.Enabled:=false; end;  procedure TForm1.SpeedButton1Click(Sender: TObject); var i,j,deger:integer; begin randomize;//Bilgisayar, program açıldığında aynı rakamları ele almasın diye. a[1]:=random(49)+1;//Çekiliş dizisine 1-49 arasında 6 farklı rakam atanıyor. a[2]:=random(49)+1; a[3]:=random(49)+1; a[4]:=random(49)+1; a[5]:=random(49)+1; a[6]:=random(49)+1; for i:=1 to 6 do for j:=i+1 to 6 do if a[i]=a[j] then a[i]:=a[i]+1;//Eğer bilgisayar rasgele aynı rakamlar tutar ise o rakamı bir arttır. for i:=1 to 6 do for j:=i+1 to 6 do if a[i]>a[j] then//Sıralama algoritması. begin deger:=a[i]; a[i]:=a[j]; a[j]:=deger; end; edit1.Text:=inttostr(a[1])+? ?+inttostr(a[2])+? ?+inttostr(a[3])+? ?+inttostr(a[4])+? ?+inttostr(a[5])+? ?+inttostr(a[6]);//Çekiliş rakamları edit bileşenine yazdırılıyor. end;  procedure TForm1.SpeedButton2Click(Sender: TObject); var i,j,deger,k:integer; begin listbox1.Clear;//Önceden yazdırılan kolonlar bir daha listbox?da görünmesin. label9.Caption:=?0?; label10.Caption:=?0?; label11.Caption:=?0?; label12.Caption:=?0?; label13.Caption:=?0?; label14.Caption:=?0?; for k:=1 to strtoint(edit2.text) do//Belirtilen kolon sayısına göre dön. begin ListBox1.*******;//Listbox?ı yenile, gözle görmemizi sağlar. label9.*******; label10.*******; label11.*******; label12.*******; label13.*******; label14.*******; randomize; b[1]:=random(49)+1;//Kolonlar dizisine 1-49 arasında 6 farklı rakamlar atanıyor. b[2]:=random(49)+1; b[3]:=random(49)+1; b[4]:=random(49)+1; b[5]:=random(49)+1; b[6]:=random(49)+1; for i:=1 to 6 do for j:=i+1 to 6 do if b[i]=b[j] then b[i]:=b[i]+1;//Kolondaki sayılardan biri eşit ise bir arttır. for i:=1 to 6 do for j:=i+1 to 6 do if b[i]>b[j] then//Sıralama algoritması. begin deger:=b[i]; b[i]:=b[j]; b[j]:=deger; end; for i:=1 to 6 do for j:=1 to 6 do if a[i]=b[j] then sayac:=sayac+1;//Çekiliş rakamları Kolonlar rakamlarından birine eşit ise sayacımızı bir arttır. if sayac=1 then begin label9.Caption:=inttostr(strtoint(label9.Caption)+1); sayac:=0; end;//Eğer sayaç bir ise o kolonda bir tutturmuştur. if sayac=2 then begin label10.Caption:=inttostr(strtoint(label10.Caption)+1); sayac:=0; end; if sayac=3 then begin label11.Caption:=inttostr(strtoint(label11.Caption)+1); sayac:=0; end; if sayac=4 then begin label12.Caption:=inttostr(strtoint(label12.Caption)+1); sayac:=0; end; if sayac=5 then begin label13.Caption:=inttostr(strtoint(label13.Caption)+1); sayac:=0; end; if sayac=6 then begin label14.Caption:=inttostr(strtoint(label14.Caption)+1); sayac:=0; end; ListBox1.Items.Add(inttostr(k)+? ? ?+inttostr(b[1])+? ?+inttostr(b[2])+? ?+inttostr(b[3])+? ?+inttostr(b[4])+? ?+inttostr(b[5])+? ?+inttostr(b[6]));//Kolonlarımız listbox bileşinine yazdırılıyor. end; end;  //Alt satırda bulunan kod kısımları tamamen görselliğe dayalıdır.  procedure TForm1.Timer2Timer(Sender: TObject); begin seffaf:=seffaf-5; AlphaBlendValue:=seffaf; if seffaf=0 then begin timer1.Enabled:=false; halt; end; end;  procedure TForm1.Label15Click(Sender: TObject); begin timer2.Enabled:=true; end;  procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin label15.Font.Color:=clred; end;  procedure TForm1.Label15MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin label15.Font.Color:=$006C6CFF; end;  procedure TForm1.Label15MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin label15.Font.Color:=$000000B0; end;
 
Üst