| Код | unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
const N = 200;
type TForm1 = class(TForm) Edit1: TEdit; Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementation
uses Math;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject); var i, j, k:Integer; a:array [1..N] of integer; begin Randomize; for i:=1 to N do a[i]:=Random(100); for i:=1 to N do begin k:=0; for j:=1 to N do if(a[i]=a[j])then begin MessageDlg('Your number: '+IntToStr(a[i]), mtInformation, [mbOK], 0); Exit; end; end; end;
end.
|
|