Advertisement
Guest User

Untitled

a guest
Feb 28th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8. Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;
  9.  
  10. type
  11.  
  12. { TForm1 }
  13.  
  14. TForm1 = class(TForm)
  15. Button1: TButton;
  16. Edit1: TEdit;
  17. Edit2: TEdit;
  18. Label1: TLabel;
  19. Label2: TLabel;
  20. Label3: TLabel;
  21. Label4: TLabel;
  22. procedure Button1Click(Sender: TObject);
  23. private
  24. { private declarations }
  25. public
  26. { public declarations }
  27. end;
  28.  
  29. var
  30. Form1: TForm1;
  31.  
  32. implementation
  33.  
  34.  
  35.  
  36. {$R *.lfm}
  37.  
  38. { TForm1 }
  39.  
  40. procedure TForm1.Button1Click(Sender: TObject);
  41. var i : byte;
  42. s1,s2,s3,s4,A,B : string;
  43. F,G,FG,GF,FF,GG : array [1..9] of byte;
  44. begin
  45. A:=Edit1.Text;
  46. B:=Edit2.Text;
  47. s1:='';
  48. s2:='';
  49. s3:='';
  50. s4:='';
  51.  
  52. if length(A) <> length(B) then
  53. begin
  54. showMessage('Blad');
  55. end
  56. else
  57. begin
  58. for i:=1 to length(A) do
  59. begin
  60. F[i]:=StrToInt(A[i]);
  61. end;
  62.  
  63. for i:=1 to length(B) do
  64. begin
  65. G[i]:=StrToInt(B[i]);
  66. end;
  67.  
  68. for i:=1 to length(A) do
  69. begin
  70. FG[i]:=F[G[i]];
  71. FF[i]:=F[F[i]];
  72. GF[i]:=G[F[i]];
  73. GG[i]:=G[G[i]];
  74. s1:=s1+IntToStr(FG[i])+',';
  75. s2:=s2+IntToStr(FF[i])+',';
  76. s3:=s3+IntToStr(GF[i])+',';
  77. s4:=s4+IntToStr(GG[i])+',';
  78. end;
  79.  
  80. Label1.Caption:='f*g=<'+s1+'>';
  81. Label2.Caption:='f*f=<'+s2+'>';
  82. Label3.Caption:='g*f=<'+s3+'>';
  83. Label4.Caption:='g*g=<'+s4+'>';
  84. end;
  85. end;
  86.  
  87. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement