D
dreamer3349
Код:
unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls;
type TForm1 = class(TForm) Label1: TLabel; RadioGroup1: TRadioGroup; Edit1: TEdit; Label2: TLabel; Edit2: TEdit; Label3: TLabel; Button1: TButton; Button2: TButton; Edit3: TEdit; Edit4: TEdit; Edit5: TEdit; Edit6: TEdit; procedure Button2Click(Sender: TObject); procedure Button1Click(Sender: TObject);
private { Private declarations } public { Public declarations } end;
var Form1: TForm1; stop:string;
implementation
{$R *.dfm}
procedure TForm1.Button2Click(Sender: TObject); begin stop:='true'; end;
procedure TForm1.Button1Click(Sender: TObject); var i,x, kol1, kol2: integer; begin stop:='false'; while stop<>'true' do begin Application.ProcessMessages; sleep(1000); edit3.Text:=' '; edit4.Text:=' '; edit1.Text:=' '; edit2.Text:=' '; edit5.Text:=' '; edit6.Text:=' '; kol1:=0; kol2:=0; For i:=1 to 3 do begin RadioGroup1.ItemIndex:=-1; x:=round(random); RadioGroup1.ItemIndex:=x; Application.ProcessMessages; sleep(100); if x=0 then begin kol1:=kol1+1; edit3.Text:=IntToStr(kol1); Application.ProcessMessages; sleep(100);end; if x=1 then begin kol2:=kol2+1; edit4.Text:=IntToStr(kol2); Application.ProcessMessages; sleep(100);end; end; Application.ProcessMessages; sleep(100); i:=1; If kol1=3 then for i:=1 to 3 do begin edit5.Text:='Òðåâîãà!'; Application.ProcessMessages; sleep(1000); end; Application.ProcessMessages; sleep(100); i:=1; If kol2=3 then for i:=1 to 3 do begin edit6.Text:='Òðåâîãà!'; Application.ProcessMessages; sleep(1000); end; Application.ProcessMessages; sleep(100); i:=1; If kol1=3 then for i:=1 to 3 do begin edit1.Text:=IntToStr(i); Application.ProcessMessages; sleep(1000); end; If kol2=3 then for i:=1 to 5 do begin edit2.text:=IntToStr(i); Application.ProcessMessages; sleep(1000); end; Application.ProcessMessages;
end;
end.