Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Unit1;
- {$mode objfpc}{$H+}
- interface
- uses
- Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;
- type
- { TForm1 }
- TForm1 = class(TForm)
- Button1: TButton;
- Edit1: TEdit;
- Edit2: TEdit;
- Label1: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- Label4: TLabel;
- procedure Button1Click(Sender: TObject);
- private
- { private declarations }
- public
- { public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.lfm}
- { TForm1 }
- procedure TForm1.Button1Click(Sender: TObject);
- var i : byte;
- s1,s2,s3,s4,A,B : string;
- F,G,FG,GF,FF,GG : array [1..9] of byte;
- begin
- A:=Edit1.Text;
- B:=Edit2.Text;
- s1:='';
- s2:='';
- s3:='';
- s4:='';
- if length(A) <> length(B) then
- begin
- showMessage('Blad');
- end
- else
- begin
- for i:=1 to length(A) do
- begin
- F[i]:=StrToInt(A[i]);
- end;
- for i:=1 to length(B) do
- begin
- G[i]:=StrToInt(B[i]);
- end;
- for i:=1 to length(A) do
- begin
- FG[i]:=F[G[i]];
- FF[i]:=F[F[i]];
- GF[i]:=G[F[i]];
- GG[i]:=G[G[i]];
- s1:=s1+IntToStr(FG[i])+',';
- s2:=s2+IntToStr(FF[i])+',';
- s3:=s3+IntToStr(GF[i])+',';
- s4:=s4+IntToStr(GG[i])+',';
- end;
- Label1.Caption:='f*g=<'+s1+'>';
- Label2.Caption:='f*f=<'+s2+'>';
- Label3.Caption:='g*f=<'+s3+'>';
- Label4.Caption:='g*g=<'+s4+'>';
- end;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement