Found the program code, you need to compile and run. I do it in RAD Studio 10.2 I create a new unit, insert the code. It produces errors by buttons, forms, etc.

unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Edit1: TEdit; Edit2: TEdit; Edit3: TEdit; Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; Memo1: TMemo; Memo2: TMemo; Memo3: TMemo; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button4Click(Sender: TObject); procedure Button3Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; // Alfabet:array [0..255] of char; str:string; newstr:string ; a,c,t,m:integer; implementation {$R *.DFM} function testingcount(s:string):boolean; var SetCount: set of char; i:integer; begin TRIM(S); IF s=” then begin testingcount:=false; exit; end; SetCount := ['1', '2','3′,'4′,'5′,'6′,'7′,'8′,'9′,'0′]; testingcount:=true; if length(s)>1 then if (not(s[1] in SetCount) and (not(s[1]<>'0′))) then // проверка, чтобы число не начиналось с нуля begin testingcount:=false; exit; end; for i:=2 to length(s) do if (not(s[i] in SetCount)) then begin testingcount:=false; exit; end; end; function code(s:char):char; //кодирование и декодирование var j,litera:integer; begin t:=(a*t+c)mod m; litera:=t xor ord(s); code:=chr(litera); end; procedure read; var i:integer; begin if testingcount(Form1.Edit1.Text) then a:=StrToInt(Form1.Edit1.Text) else begin ShowMessage('Некорректно задан параметр А'); exit; end; if testingcount(Form1.Edit2.Text) then c:=StrToInt(Form1.Edit2.Text) else begin ShowMessage('Некорректно задан параметр C'); exit; end; if testingcount(Form1.Edit3.Text) then t:=StrToInt(Form1.Edit3.Text) else begin ShowMessage('Некорректно задана порождающая величина'); exit; end; end; procedure transformation(var s,s1:string); var i:integer; res:char; begin s1:=”; m:=32; for i:=1 to length(s) do begin if ((ord(s[i])=$A) or (ord(s[i])=$D) ) then s1:=s1+s[i] else begin res:=code(s[i]); s1:=s1+res; end; end; end; procedure TForm1.Button1Click(Sender: TObject); var j,litera:integer; begin read; str:=Form1.Memo1.Text; transformation(str,newstr); Form1.Memo2.Text:=NEWstr; end; procedure TForm1.Button2Click(Sender: TObject); begin Form1.Memo1.Clear; end; procedure TForm1.Button4Click(Sender: TObject); begin Form1.Memo2.Clear; end; procedure TForm1.Button3Click(Sender: TObject); begin Form1.Memo3.Text:=”; newstr:=Form1.Memo2.Text; read; transformation(newstr,str); Form1.Memo3.Text:=str; end; end. 

Closed due to the fact that Kromster , MihailPw , aleksandr barakin , Yaroslav Molchan , αλεχολυτ 8 Jun '17 at 12:02 are off-topic .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - Kromster, MihailPw, Yaroslav Molchan, αλεχολυτ
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • 3
    {$R *.DFM} line {$R *.DFM} tell you anything? - Igor
  • one
    Questions asking for help with debugging (“why does this code not work?”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question. Questions without an explicit description of the problem are useless for other visitors. - Kromster

1 answer 1

Create a new unit, insert the code.

This approach is good for console applications. You have a module for the VCL form. It consists of 2 files <Unit>.pas and <Unit>.dfm . The code is stored in <Unit>.dfm , the markup is stored in <Unit>.dfm .

In fact, you lack the <Unit>.dfm . It may look like this:

 object Form1: TForm1 Left = 0 Top = 0 Caption = 'Form1' ClientHeight = 373 ClientWidth = 535 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] OldCreateOrder = False PixelsPerInch = 96 TextHeight = 13 object Label1: TLabel Left = 8 Top = 11 Width = 31 Height = 13 Caption = 'Label1' end object Label2: TLabel Left = 8 Top = 43 Width = 31 Height = 13 Caption = 'Label2' end object Label3: TLabel Left = 8 Top = 75 Width = 31 Height = 13 Caption = 'Label3' end object Label4: TLabel Left = 313 Top = 11 Width = 31 Height = 13 Caption = 'Label4' end object Label5: TLabel Left = 313 Top = 125 Width = 31 Height = 13 Caption = 'Label5' end object Label6: TLabel Left = 313 Top = 239 Width = 31 Height = 13 Caption = 'Label6' end object Edit1: TEdit Left = 72 Top = 8 Width = 121 Height = 21 TabOrder = 0 Text = 'Edit1' end object Edit2: TEdit Left = 72 Top = 40 Width = 121 Height = 21 TabOrder = 1 Text = 'Edit2' end object Edit3: TEdit Left = 72 Top = 72 Width = 121 Height = 21 TabOrder = 2 Text = 'Edit3' end object Button1: TButton Left = 216 Top = 17 Width = 75 Height = 25 Caption = 'Button1' TabOrder = 3 OnClick = Button1Click end object Button2: TButton Left = 216 Top = 49 Width = 75 Height = 25 Caption = 'Clear memo1' TabOrder = 4 OnClick = Button2Click end object Button3: TButton Left = 216 Top = 81 Width = 75 Height = 25 Caption = 'Button3' TabOrder = 5 OnClick = Button3Click end object Button4: TButton Left = 216 Top = 113 Width = 75 Height = 25 Caption = 'Clear memo2' TabOrder = 6 OnClick = Button4Click end object Memo1: TMemo Left = 313 Top = 30 Width = 185 Height = 89 Lines.Strings = ( 'Memo1') TabOrder = 7 end object Memo2: TMemo Left = 313 Top = 144 Width = 185 Height = 89 Lines.Strings = ( 'Memo2') TabOrder = 8 end object Memo3: TMemo Left = 313 Top = 258 Width = 185 Height = 89 Lines.Strings = ( 'Memo3') TabOrder = 9 end end