Advertisement
daniv1

Untitled

May 11th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.70 KB | None | 0 0
  1. unit Unit6;
  2.  
  3. interface
  4.  
  5. uses
  6.   Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  7.   Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Random;
  8.  
  9. type
  10.   TForm6 = class(TForm)
  11.     Random2: TRandom;
  12.     Button1: TButton;
  13.     Edit1: TEdit;
  14.     Edit2: TEdit;
  15.     Label1: TLabel;
  16.     Label2: TLabel;
  17.     Label3: TLabel;
  18.     Label4: TLabel;
  19.     Label5: TLabel;
  20.     Label6: TLabel;
  21.     Label7: TLabel;
  22.     Label8: TLabel;
  23.     procedure Button1Click(Sender: TObject);
  24.     procedure Label1Click(Sender: TObject);
  25.     procedure FormCreate(Sender: TObject);
  26.   private
  27.     { Private declarations }
  28.   public
  29.     { Public declarations }
  30.   end;
  31.  
  32. var
  33.   Form6: TForm6;
  34.    cnt_min , cnt_max  : Integer;
  35. implementation
  36.  
  37. {$R *.dfm}
  38.  
  39.  
  40. procedure TForm6.Button1Click(Sender: TObject);
  41.         var i : integer;
  42. begin
  43.  
  44.     form6.Caption := '';
  45.        random2.max := StrToInt(Edit1.Text);
  46.         random2.min := StrToInt(Edit2.Text);
  47.         i := random2.GetNumber;
  48.    random2.Caption := IntToStr(i);
  49.    if(    i= random2.min ) then
  50.    begin
  51.    cnt_min := cnt_min +1 ;
  52.              label8.Caption := IntToStr(cnt_min);
  53.        form6.Caption := 'досягнуто мінімального значення' ;
  54.    end;
  55.    if(    i = random2.max ) then
  56.    begin
  57.     cnt_max := cnt_max +1 ;
  58.                    label6.Caption := IntToStr(cnt_max);
  59.        form6.Caption := 'досягнуто максимального значення' ;
  60.    end;
  61. end;
  62.  
  63. procedure TForm6.FormCreate(Sender: TObject);
  64. begin
  65. cnt_min := 0;
  66. cnt_max := 0;
  67. end;
  68.  
  69. procedure TForm6.Label1Click(Sender: TObject);
  70. begin
  71.    ShowMessage('generation of random numbers ' );
  72. end;
  73.  
  74. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement