Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Unit6;
- interface
- uses
- Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
- Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Random;
- type
- TForm6 = class(TForm)
- Random2: TRandom;
- Button1: TButton;
- Edit1: TEdit;
- Edit2: TEdit;
- Label1: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- Label4: TLabel;
- Label5: TLabel;
- Label6: TLabel;
- Label7: TLabel;
- Label8: TLabel;
- procedure Button1Click(Sender: TObject);
- procedure Label1Click(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form6: TForm6;
- cnt_min , cnt_max : Integer;
- implementation
- {$R *.dfm}
- procedure TForm6.Button1Click(Sender: TObject);
- var i : integer;
- begin
- form6.Caption := '';
- random2.max := StrToInt(Edit1.Text);
- random2.min := StrToInt(Edit2.Text);
- i := random2.GetNumber;
- random2.Caption := IntToStr(i);
- if( i= random2.min ) then
- begin
- cnt_min := cnt_min +1 ;
- label8.Caption := IntToStr(cnt_min);
- form6.Caption := 'досягнуто мінімального значення' ;
- end;
- if( i = random2.max ) then
- begin
- cnt_max := cnt_max +1 ;
- label6.Caption := IntToStr(cnt_max);
- form6.Caption := 'досягнуто максимального значення' ;
- end;
- end;
- procedure TForm6.FormCreate(Sender: TObject);
- begin
- cnt_min := 0;
- cnt_max := 0;
- end;
- procedure TForm6.Label1Click(Sender: TObject);
- begin
- ShowMessage('generation of random numbers ' );
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement