ďťż

Ładny brzuch

Dlaczego program:
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs,Math, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Edit1: TEdit; Edit2: TEdit; Label5: TLabel; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public procedure Losuj; procedure Losuj1; end; var Form1: TForm1; l1,l2,w1,w2,a,b,o1,o,p,p1,p2:Double; implementation procedure TForm1.Losuj; begin l1:=RandomRange(0,100); end; procedure TForm1.Losuj1; begin l2:=RandomRange(100,200); end; {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin o:=Strtofloat(edit1.Text); o1:=Strtofloat(edit2.Text); if w1 = o then begin Label3.Caption:='Punkty:1'; p:=1; end else Label3.Caption:='Punkty:0'; p:=0; if w2=o1 then begin Label4.Caption:='Punkty:1'; p1:=1; end else Label4.Caption:='Punkty:0'; p1:=0; p2:=p1+p1; ShowMessage(floattostr(p2)); Label5.caption:=Floattostr(p2); end; procedure TForm1.Button2Click(Sender: TObject); begin a:=1.5; b:=3; Losuj; Losuj1; Label1.Caption:=floattostr(l1)+' + '+floattostr(a); Label2.Caption:=floattostr(l2)+' + '+floattostr(B); w1:=l1+a; w2:=l2+b; end; end.
losuje ciągle te same liczby?

codebox - Bełdzio
Użytkownik Bełdzio edytował ten post 28 kwiecień 2005, 13:25


Pewnie dlatego ze nie dales polecenia Randomize;

W onCreate formy daj Randomize; :)


W onCreate formy daj Randomize; :)

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • zsf.htw.pl
  •