,  , Delphi

 
 
anyakrg
0 / 0 / 1
: 22.10.2012
: 183
#1

24.04.2014, 18:47. 289. 2
( )

,



Delphi
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
unit Unit1;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, Menus, XPMan, Unit2;
 
type
  TDeCryptor = class(TForm)
    Label3: TLabel;
    ListBox1: TListBox;
    Input: TMemo;
    Start: TButton;
    Output: TMemo;
    InputButton2: TButton;
    InputButton3: TButton;
    OpenDialog1: TOpenDialog;
    SaveDialog1: TSaveDialog;
    xpmnfst1: TXPManifest;
    mm1: TMainMenu;
    DeCryptFile1: TMenuItem;
    Open: TMenuItem;
    Save: TMenuItem;
    SaveAs: TMenuItem;
    DeCryptN7: TMenuItem;
    Quit: TMenuItem;
    DeCryptN1: TMenuItem;
    DeCrypt: TMenuItem;
    DeCryptN2: TMenuItem;
    CheckCrypt: TMenuItem;
    DeCryptN3: TMenuItem;
    Help: TMenuItem;
    About: TMenuItem;
    procedure OpenClick(Sender: TObject);
    procedure SaveClick(Sender: TObject);
    procedure SaveAsClick(Sender: TObject);
    procedure CheckCryptClick(Sender: TObject);
    procedure Label3Click(Sender: TObject);
    procedure StartClick(Sender: TObject);
    procedure InputButton3Click(Sender: TObject);
    procedure InputButton2Click(Sender: TObject);
    procedure DeCryptClick(Sender: TObject);
    procedure decrypt;
    procedure FormCreate(Sender: TObject);
    procedure ListBox1Click(Sender: TObject);
  private
    { Private declarations }
    procedure decrypt;
    
  public
    { Public declarations }
  end;
 
  type RESULT=record // îáúÿâëå*èå ñòðóêòóðêè ï*ð ñèìâîëîâ
  orig : char;
  new : char;
end;
 
var
  DeCryptor: TDeCryptor;
  mask : array[1..128, 0..32] of word; // Ì*ññèâ ì*ñêè(128 - ì*êñèì*ëü*îå êîëè÷åñòâî ñëîâ, 32 - ì*êñèñì*ëü*îå êîëè÷åñòâî áóêâ â ñëîâå)
  symb : array[1..65536] of RESULT; // Ì*ññèâ ðåçóëüò*ò* - ï*ð* áóêâ*-áóêâ*(á*ç* *ëô*âèò*)
  k, n : word; // ê - êîëè÷åñòâî ñëîâ, * - êîëè÷åñòâî ñèìâîëîâ â *ëô*âèòå
  bl : boolean; // ëîãè÷åñê*ÿ ïåðåìå***ÿ "Í*éäå* ëè îòâåò"
  fl : string; // ïåðåìå***ÿ ïóòè ê ñëîâ*ðþ
  FileWork: String;
  i, l, strt : word;
  tmp : string;
implementation
 
{$R *.dfm}
 
function IsZnak(c : char): boolean; // ôó*êöèÿ ïðîâåðêè ñèìâîë* ** ç**ê: Ðåçóëüò*ò 1 - ñèìâîë - ç**ê; 0 - ñèìâîë *å ç**ê
var
  bl : boolean;
begin
  bl := false;
  if (c = ',') or (c = ' ') or (c = '!') or (c = '?') or (c = '.') then // ñþä* ìîæ** äîïèñ*òü åùå óñëîâèÿ, åñëè *óæ*î
    bl := true;
 
  IsZnak := bl;
end;
 
function NotExistInBase(c : char): boolean; // ôó*êöèÿ ïðîâåðêè ** åäè*ñòâå**îñòü ñèìâîë* â *ëô*âèòå ñèìâîëîâ: Ðåçóëüò*ò 1 - ñèìâîë* *åò; 0 - ñèìâîë åñòü
var
  i : integer;
begin
  NotExistInBase := false;
  for i := 1 to n do
    if (symb[i].new = c) then
      Exit;
 
  NotExistInBase := true;
end;
 
 
function SymbolsInBase(s : string; a : array of word): boolean; // ôó*êöèÿ ïðîâåðêè ** êîððåêò*îñòü è åñëè *óæ*î äîá*âëå*èÿ ï*ðè ñèìâîëîâ â ì*ññèâ ï*ð
var
    i, j : integer;
begin
  SymbolsInBase := true;
 
  for i := 1 to length(s) do
  begin
    for j := 1 to n do
      if (ord(symb[j].orig) = a[i]) then // åñëè ñèìâë èñõîä*îãî åëåìå*ò* ð*âå* ñèìâîëó èç á*çè
        if (symb[j].new <> s[i]) then // åñëè âòîðîé ñèìâîë ÍÅ ð*âå* ñèìâîëó èç á*çè
        begin
          SymbolsInBase := false; // âåð*óòü 0, ò.å. ÍÅÑÎÂÏÀÄÅÍÈÅ
          Exit;
        end
        else
          break;
 
    if (j > n) then // åñëè *åò ò*êîé ï*ðè, òî äîá*âëÿåì åùå ï*ðó
    begin
      if not NotExistInBase(s[i]) then // ïðîâåðê* ** åäè*ñòâå**îñòü ñèìâîë* â á*çå
      begin
        SymbolsInBase := false;
        Exit;
      end;
      n := n+1;
      symb[n].orig := chr(a[i]);
      symb[n].new := s[i];
    end;
  end;
end;
 
 
function IsMask(tmp : string; s : array of word): Boolean;
   // ïðîâåðÿåò ïîäõîäèò ëè **ì ñëîâî ñ ñëîâ*ðÿ ïî ì*ñêå ò.å. ïî ýòîìó *ëãîðèòìó
   // ñëîâ* 12 = as, 122 = too....
var
    i, j : word;
begin
  IsMask := false;
 
  for i := 1 to length(tmp) do
    for j := i+1 to length(tmp) do
      if (((tmp[i] = tmp[j]) and (s[i] <> s[j])) or ((tmp[i] <> tmp[j]) and
           (s[i] = s[j]))) then // ïðîâåðÿåò ïîäõîäèò ëè **ì åòè ñëîâ* ïî ì*ñêå
        Exit;
 
  IsMask := true;
end;
 
function FindWords(pot : integer): boolean; // ðåêóðñèâ**ÿ ôó*êöèÿ ïîèñêó ïîäõîäÿùèõ **ì ñëîâ
var
    inp : text;
    s : string;
    tmp : word;
begin
  bl := false;
  if (pot = k) then // óñëîâèå âûõîä* èç ðåêóðñèè
  begin
    FindWords := true;
    Exit;
  end;
 
  AssignFile(inp, fl); // îòêðûâ*åì ô*éë äëÿ ÷òå*èÿ
  reset(inp);
 
  while not Eof(inp) do // ïîê* *å êî*åö ô*éë*
  begin
    readln(inp, s); // ÷èò*åì ñëîâî èç ñëîâ*ðÿ
 
    if (length(s) = mask[pot+1, 0]) and IsMask(s, mask[pot+1]) then // åñëè äëè*** ñëîâ* ïîäõîäèò **ì è î*î ïîäõîäèò ïî ì*ñêå
    begin
      tmp := n; // ç*ïîì*èì êîëè÷åñòâî ñèìâîëîâ â á*çå *ëô*âèò*
      if SymbolsInBase(s, mask[pot+1]) then // è åñëè âñå õîîðøî èç *îâûì *ëô*âèòîì
        if (FindWords(pot+1)) then // è åñëè ýòî êî*åö ðåêóðñèè,òî
          bl := true; // ãîâîðèì, ÷òî äåøûôðîâê* ÓÑÏÅØÍÀß!!!
          
      if (not bl) then // åñëè *å óñïåõ, òî
        n := tmp; // ìå*ÿåò êîëè÷åñòâî ñèìâîëîâ â *ëô*âèòå ** ñò*ðîå
    end;
  end;
  close(inp); // ç*âåðø*åì ðîáîòó ñ ô*éëîì
  FindWords := false;
end;
 
function EnCode(c : char): char; // ôó*êöèÿ ð*ñêîäèðîâêè ñèìâîë*, èìåÿ *ëô*âèò
var
  i : integer;
begin
  for i := 1 to n do
    if symb[i].orig = c then // åñëè óä*÷*, òî âåðò*åì ñèìâîë èù *îâîãî *ëô*âèò*
    begin
      EnCode := symb[i].new;
      Exit;
    end;
 
  EnCode := c; // åñëè *åò ñèìâîë* â *îâîì *ëô*âèòå, òî âåðò*åì òîò, êîòîðèé ïðèøåë
end;
 
procedure TDeCryptor.decrypt;
 
begin
  n := 0;
  if fl = '' then
  begin
    ShowMessage('Not Selected Dictionary!');
    Exit;
  end;
Label3.Caption := 'WORKING, please wait!!!';
Label3.Refresh;
 
  for i := 1 to 128 do
    for l := 1 to 32 do
      mask[i, l] := 0;
  input.Text := input.Text + ' ';
 
  k := 1;
  strt := 2;
  for i := 1 to length(input.Text) do
  begin
    if ((i < 2) or IsZnak(input.Text[i-1])) and (not IsZnak(input.Text[i])) then
      strt := i;
 
    if ((IsZnak(input.Text[i]) or (i = length(input.Text))) and (i > 1) and
          (not IsZnak(input.Text[i-1]))) then
    begin
      l := i-1;
      if (l-strt+1 > 32) then
      begin
        ShowMessage('Max length of word: 32');
        Exit;
      end;
      mask[k, 0] := l-strt+1;
      while (l >= strt) and (not IsZnak(input.Text[l])) do
      begin
        mask[k, l-strt+1] := ord(input.Text[l]);
        l := l - 1;
      end;
      k := k + 1;
      if (k > 128) then
      begin
        ShowMessage('Max words: 128');
        Exit;
      end;
    end;
  end;
  k := k - 1;
 
  FindWords(0);
  if bl then
  begin
    Decryptor. label3.Caption:= 'Success!' + chr(10) + chr(13) + chr(10) + chr(13);
 
    for i := 1 to n do
      Decryptor. Input.text:= Decryptor. Input.text + chr(10) + chr(13) +
         symb[i].orig + ' => ' + symb[i].new+chr(13);
 
    Decryptor.Input.text := Decryptor.input.text +chr(13)+ chr(10) + chr(13) +
         chr(10) + chr(13) + 'Result: ';
 
    for i := 1 to length(input.Text) do
      Decryptor.Input.text := Decryptor.input.text + EnCode(input.Text[i])
  end
  else
    Decryptor.Input.text := 'Fail: no correct mask!!!' + chr(10) + chr(13) +
            chr(10) + chr(13);
 
end;
 
 
 
procedure TDeCryptor.OpenClick(Sender: TObject);
begin
  gg
end;
 
procedure TDeCryptor.SaveClick(Sender: TObject);
begin
  ff
end;
 
procedure TDeCryptor.SaveAsClick(Sender: TObject);
begin
    ff
end;
 
procedure TDeCryptor.CheckCryptClick(Sender: TObject);
begin
   CheckCrypt.Visible;
end;
 
procedure TDeCryptor.StartClick(Sender: TObject);
begin
  decrypt;
end;
 
procedure TDeCryptor.InputButton3Click(Sender: TObject);
begin
       ff
end;
 
procedure TDeCryptor.InputButton2Click(Sender: TObject);
begin
       ff
end;
 
procedure TDeCryptor.DeCryptClick(Sender: TObject);
begin
  decrypt;
end;
 
procedure TDeCryptor.FormCreate(Sender: TObject);
begin
  n := 0;
  k := 1;
  fl := '';
 
end;
 
procedure TDeCryptor.ListBox1Click(Sender: TObject);
var
    i : integer;
begin
  For i:=0 to ListBox1.Items.Count-1 do
    If (ListBox1.Selected[i]) then // åñëè **æ*òûé åëåìå*ò **éäå*, òî ïðèñâ*åâ*åì ïåðåìå**îé fl **çâ**èå ñëîâ*ðÿ
    begin
      fl := ListBox1.Items.Strings[i];
      exit;
    end;
 
end;
 
end.
0
? .
Similar
41792 / 34177 / 6122
: 12.04.2006
: 57,940
24.04.2014, 18:47
:

( String).
: ,...


unit Unit1; interface uses Windows, Messages, SysUtils, Variants,...

,
, ) , ...


( ), ...

!
, . ?

2
FIL
24.04.2014, 18:50
  #2

:

anyakrg

.

0
anyakrg
0 / 0 / 1
: 22.10.2012
: 183
24.04.2014, 18:55  [] #3
FIL,

49 - Overloaded procedure 'decrypt' must be marked with the 'overload' directive
Delphi
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
unit Unit1;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, Menus, XPMan, Unit2;
 
type
  TDeCryptor = class(TForm)
    Label3: TLabel;
    ListBox1: TListBox;
    Input: TMemo;
    Start: TButton;
    Output: TMemo;
    InputButton2: TButton;
    InputButton3: TButton;
    OpenDialog1: TOpenDialog;
    SaveDialog1: TSaveDialog;
    xpmnfst1: TXPManifest;
    mm1: TMainMenu;
    DeCryptFile1: TMenuItem;
    Open: TMenuItem;
    Save: TMenuItem;
    SaveAs: TMenuItem;
    DeCryptN7: TMenuItem;
    Quit: TMenuItem;
    DeCryptN1: TMenuItem;
    DeCrypt1: TMenuItem;
    DeCryptN2: TMenuItem;
    CheckCrypt: TMenuItem;
    DeCryptN3: TMenuItem;
    Help: TMenuItem;
    About: TMenuItem;
    procedure OpenClick(Sender: TObject);
    procedure SaveClick(Sender: TObject);
    procedure SaveAsClick(Sender: TObject);
    procedure CheckCryptClick(Sender: TObject);
    procedure Label3Click(Sender: TObject);
    procedure StartClick(Sender: TObject);
    procedure InputButton3Click(Sender: TObject);
    procedure InputButton2Click(Sender: TObject);
    procedure DeCrypt1Click(Sender: TObject);
    procedure decrypt;
    procedure FormCreate(Sender: TObject);
    procedure ListBox1Click(Sender: TObject);
  private
    { Private declarations }
    procedure decrypt;
    
  public
    { Public declarations }
  end;
 
  type RESULT=record // îáúÿâëå*èå ñòðóêòóðêè ï*ð ñèìâîëîâ
  orig : char;
  new : char;
end;
 
var
  DeCryptor: TDeCryptor;
  mask : array[1..128, 0..32] of word; // Ì*ññèâ ì*ñêè(128 - ì*êñèì*ëü*îå êîëè÷åñòâî ñëîâ, 32 - ì*êñèñì*ëü*îå êîëè÷åñòâî áóêâ â ñëîâå)
  symb : array[1..65536] of RESULT; // Ì*ññèâ ðåçóëüò*ò* - ï*ð* áóêâ*-áóêâ*(á*ç* *ëô*âèò*)
  k, n : word; // ê - êîëè÷åñòâî ñëîâ, * - êîëè÷åñòâî ñèìâîëîâ â *ëô*âèòå
  bl : boolean; // ëîãè÷åñê*ÿ ïåðåìå***ÿ "Í*éäå* ëè îòâåò"
  fl : string; // ïåðåìå***ÿ ïóòè ê ñëîâ*ðþ
  FileWork: String;
  i, l, strt : word;
  tmp : string;
implementation
 
{$R *.dfm}
 
function IsZnak(c : char): boolean; // ôó*êöèÿ ïðîâåðêè ñèìâîë* ** ç**ê: Ðåçóëüò*ò 1 - ñèìâîë - ç**ê; 0 - ñèìâîë *å ç**ê
var
  bl : boolean;
begin
  bl := false;
  if (c = ',') or (c = ' ') or (c = '!') or (c = '?') or (c = '.') then // ñþä* ìîæ** äîïèñ*òü åùå óñëîâèÿ, åñëè *óæ*î
    bl := true;
 
  IsZnak := bl;
end;
 
function NotExistInBase(c : char): boolean; // ôó*êöèÿ ïðîâåðêè ** åäè*ñòâå**îñòü ñèìâîë* â *ëô*âèòå ñèìâîëîâ: Ðåçóëüò*ò 1 - ñèìâîë* *åò; 0 - ñèìâîë åñòü
var
  i : integer;
begin
  NotExistInBase := false;
  for i := 1 to n do
    if (symb[i].new = c) then
      Exit;
 
  NotExistInBase := true;
end;
 
 
function SymbolsInBase(s : string; a : array of word): boolean; // ôó*êöèÿ ïðîâåðêè ** êîððåêò*îñòü è åñëè *óæ*î äîá*âëå*èÿ ï*ðè ñèìâîëîâ â ì*ññèâ ï*ð
var
    i, j : integer;
begin
  SymbolsInBase := true;
 
  for i := 1 to length(s) do
  begin
    for j := 1 to n do
      if (ord(symb[j].orig) = a[i]) then // åñëè ñèìâë èñõîä*îãî åëåìå*ò* ð*âå* ñèìâîëó èç á*çè
        if (symb[j].new <> s[i]) then // åñëè âòîðîé ñèìâîë ÍÅ ð*âå* ñèìâîëó èç á*çè
        begin
          SymbolsInBase := false; // âåð*óòü 0, ò.å. ÍÅÑÎÂÏÀÄÅÍÈÅ
          Exit;
        end
        else
          break;
 
    if (j > n) then // åñëè *åò ò*êîé ï*ðè, òî äîá*âëÿåì åùå ï*ðó
    begin
      if not NotExistInBase(s[i]) then // ïðîâåðê* ** åäè*ñòâå**îñòü ñèìâîë* â á*çå
      begin
        SymbolsInBase := false;
        Exit;
      end;
      n := n+1;
      symb[n].orig := chr(a[i]);
      symb[n].new := s[i];
    end;
  end;
end;
 
 
function IsMask(tmp : string; s : array of word): Boolean;
   // ïðîâåðÿåò ïîäõîäèò ëè **ì ñëîâî ñ ñëîâ*ðÿ ïî ì*ñêå ò.å. ïî ýòîìó *ëãîðèòìó
   // ñëîâ* 12 = as, 122 = too....
var
    i, j : word;
begin
  IsMask := false;
 
  for i := 1 to length(tmp) do
    for j := i+1 to length(tmp) do
      if (((tmp[i] = tmp[j]) and (s[i] <> s[j])) or ((tmp[i] <> tmp[j]) and
           (s[i] = s[j]))) then // ïðîâåðÿåò ïîäõîäèò ëè **ì åòè ñëîâ* ïî ì*ñêå
        Exit;
 
  IsMask := true;
end;
 
function FindWords(pot : integer): boolean; // ðåêóðñèâ**ÿ ôó*êöèÿ ïîèñêó ïîäõîäÿùèõ **ì ñëîâ
var
    inp : text;
    s : string;
    tmp : word;
begin
  bl := false;
  if (pot = k) then // óñëîâèå âûõîä* èç ðåêóðñèè
  begin
    FindWords := true;
    Exit;
  end;
 
  AssignFile(inp, fl); // îòêðûâ*åì ô*éë äëÿ ÷òå*èÿ
  reset(inp);
 
  while not Eof(inp) do // ïîê* *å êî*åö ô*éë*
  begin
    readln(inp, s); // ÷èò*åì ñëîâî èç ñëîâ*ðÿ
 
    if (length(s) = mask[pot+1, 0]) and IsMask(s, mask[pot+1]) then // åñëè äëè*** ñëîâ* ïîäõîäèò **ì è î*î ïîäõîäèò ïî ì*ñêå
    begin
      tmp := n; // ç*ïîì*èì êîëè÷åñòâî ñèìâîëîâ â á*çå *ëô*âèò*
      if SymbolsInBase(s, mask[pot+1]) then // è åñëè âñå õîîðøî èç *îâûì *ëô*âèòîì
        if (FindWords(pot+1)) then // è åñëè ýòî êî*åö ðåêóðñèè,òî
          bl := true; // ãîâîðèì, ÷òî äåøûôðîâê* ÓÑÏÅØÍÀß!!!
          
      if (not bl) then // åñëè *å óñïåõ, òî
        n := tmp; // ìå*ÿåò êîëè÷åñòâî ñèìâîëîâ â *ëô*âèòå ** ñò*ðîå
    end;
  end;
  close(inp); // ç*âåðø*åì ðîáîòó ñ ô*éëîì
  FindWords := false;
end;
 
function EnCode(c : char): char; // ôó*êöèÿ ð*ñêîäèðîâêè ñèìâîë*, èìåÿ *ëô*âèò
var
  i : integer;
begin
  for i := 1 to n do
    if symb[i].orig = c then // åñëè óä*÷*, òî âåðò*åì ñèìâîë èù *îâîãî *ëô*âèò*
    begin
      EnCode := symb[i].new;
      Exit;
    end;
 
  EnCode := c; // åñëè *åò ñèìâîë* â *îâîì *ëô*âèòå, òî âåðò*åì òîò, êîòîðèé ïðèøåë
end;
 
procedure TDeCryptor.decrypt;
 
begin
  n := 0;
  if fl = '' then
  begin
    ShowMessage('Not Selected Dictionary!');
    Exit;
  end;
Label3.Caption := 'WORKING, please wait!!!';
Label3.Refresh;
 
  for i := 1 to 128 do
    for l := 1 to 32 do
      mask[i, l] := 0;
  input.Text := input.Text + ' ';
 
  k := 1;
  strt := 2;
  for i := 1 to length(input.Text) do
  begin
    if ((i < 2) or IsZnak(input.Text[i-1])) and (not IsZnak(input.Text[i])) then
      strt := i;
 
    if ((IsZnak(input.Text[i]) or (i = length(input.Text))) and (i > 1) and
          (not IsZnak(input.Text[i-1]))) then
    begin
      l := i-1;
      if (l-strt+1 > 32) then
      begin
        ShowMessage('Max length of word: 32');
        Exit;
      end;
      mask[k, 0] := l-strt+1;
      while (l >= strt) and (not IsZnak(input.Text[l])) do
      begin
        mask[k, l-strt+1] := ord(input.Text[l]);
        l := l - 1;
      end;
      k := k + 1;
      if (k > 128) then
      begin
        ShowMessage('Max words: 128');
        Exit;
      end;
    end;
  end;
  k := k - 1;
 
  FindWords(0);
  if bl then
  begin
    Decryptor. label3.Caption:= 'Success!' + chr(10) + chr(13) + chr(10) + chr(13);
 
    for i := 1 to n do
      Decryptor. Input.text:= Decryptor. Input.text + chr(10) + chr(13) +
         symb[i].orig + ' => ' + symb[i].new+chr(13);
 
    Decryptor.Input.text := Decryptor.input.text +chr(13)+ chr(10) + chr(13) +
         chr(10) + chr(13) + 'Result: ';
 
    for i := 1 to length(input.Text) do
      Decryptor.Input.text := Decryptor.input.text + EnCode(input.Text[i])
  end
  else
    Decryptor.Input.text := 'Fail: no correct mask!!!' + chr(10) + chr(13) +
            chr(10) + chr(13);
 
end;
 
 
 
procedure TDeCryptor.OpenClick(Sender: TObject);
begin
  gg
end;
 
procedure TDeCryptor.SaveClick(Sender: TObject);
begin
  ff
end;
 
procedure TDeCryptor.SaveAsClick(Sender: TObject);
begin
    ff
end;
 
procedure TDeCryptor.CheckCryptClick(Sender: TObject);
begin
   CheckCrypt.Visible;
end;
 
procedure TDeCryptor.StartClick(Sender: TObject);
begin
  decrypt;
end;
 
procedure TDeCryptor.InputButton3Click(Sender: TObject);
begin
       ff
end;
 
procedure TDeCryptor.InputButton2Click(Sender: TObject);
begin
       ff
end;
 
procedure TDeCryptor.DeCrypt1Click(Sender: TObject);
begin
  decrypt;
end;
 
procedure TDeCryptor.FormCreate(Sender: TObject);
begin
  n := 0;
  k := 1;
  fl := '';
 
end;
 
procedure TDeCryptor.ListBox1Click(Sender: TObject);
var
    i : integer;
begin
  For i:=0 to ListBox1.Items.Count-1 do
    If (ListBox1.Selected[i]) then // åñëè **æ*òûé åëåìå*ò **éäå*, òî ïðèñâ*åâ*åì ïåðåìå**îé fl **çâ**èå ñëîâ*ðÿ
    begin
      fl := ListBox1.Items.Strings[i];
      exit;
    end;
 
end;
 
end.
1

0
MoreAnswers
37091 / 29110 / 5898
: 17.06.2006
: 43,301
24.04.2014, 18:55

.
unit Unit1; interface uses Windows, Messages, SysUtils, Variants,...


: Expected FINALLY but received else at line...

3
3




:
3

- , ,
-
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
@Mail.ru