-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUnit1.txt
131 lines (107 loc) · 2.25 KB
/
Unit1.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, sEdit, sSpinEdit, Buttons, ExtCtrls;
type
TForm1 = class(TForm)
GroupBox1: TGroupBox;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
CheckBox3: TCheckBox;
CheckBox4: TCheckBox;
BitBtn1: TBitBtn;
Memo1: TMemo;
Label1: TLabel;
Label2: TLabel;
sSpinEdit1: TsSpinEdit;
sSpinEdit2: TsSpinEdit;
Button1: TButton;
procedure BitBtn1Click(Sender: TObject);
procedure sSpinEdit2Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.BitBtn1Click(Sender: TObject);
var pass:string; e,p,r:byte; sel:array [0..255] of byte;
begin
p:=0;
if (CheckBox1.Checked=false) and (CheckBox2.Checked=false) and (CheckBox3.Checked=false) and (CheckBox4.Checked=false)
then MessageBox(handle,'Âû íå âûáðàëè íè îäíîãî òèïà ñèìâîëîâ äëÿ ãåíåðàöèè.'+#13+'Âûáåðèòå õîòÿ áû îäèí òèï è ïîâòîðèòå çàïðîñ.','Âíèìàíèå!',MB_ICONWARNING)
else
begin
repeat
e:=0;
pass:='';
r:=0;
randomize;
repeat
if CheckBox1.Checked then
begin
// big
repeat
r:=random(91);
until r>64;
sel[0]:=r;
end else sel[0]:=0;
if CheckBox2.Checked then
begin
// small
repeat
r:=random(123);
until r>96;
sel[1]:=r;
end else sel[1]:=0;
if CheckBox3.Checked then
begin
// dig
repeat
r:=random(58);
until r>47;
sel[2]:=r;
end else sel[2]:=0;
if CheckBox4.Checked then
begin
// symb
repeat
r:=random(47);
until r>32;
sel[3]:=r;
end else sel[3]:=0;
{memo1.Lines.Add(inttostr(sel[0])+', '+
inttostr(sel[1])+', '+
inttostr(sel[2])+', '+
inttostr(sel[3])+', '+inttostr(r));}
r:=0;
while r=0 do
r:=sel[random(4)];
pass:=pass+chr(r);
e:=e+1;
until e=sspinedit1.value;
memo1.Lines.Add(pass);
pass:='';
p:=p+1;
until p=sSpinEdit2.Value;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
memo1.Lines.Clear;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
BitBtn1.Caption:='Ñãåíåðèðîâàòü '+sSpinEdit2.Text+' øòóê';
end;
procedure TForm1.sSpinEdit2Change(Sender: TObject);
begin
BitBtn1.Caption:='Ñãåíåðèðîâàòü '+sSpinEdit2.Text+' øòóê';
end;
end.