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
| procedure TForm1.Button1Click(Sender: TObject);
var
st1, st2, st3, st4: string;
i1, i2, i3, i4 : integer;
begin
st1 := 'JESUISLEMESSAGEENCLAIR';
st2 := 'CESARCESARCESARCESARCE';
st3 := '';
for i1 := 1 to length(st1) do
begin
i2 := ord(st1[i1]) - 65;
i3 := ord(st2[i1]) - 65;
st3 := st3 + chr(((i2 + i3 + 1) mod 26) + 65);
end;
st4 := '';
for i1 := 1 to length(st1) do
begin
i2 := ord(st3[i1]) - 65;
i3 := ord(st2[i1]) - 65;
st4 := st4 + chr(((26 + i2 - i3 -1 ) mod 26) + 65);
end;
ListBox1.clear;
ListBox1.Items.add(st1);
ListBox1.Items.add(st2);
ListBox1.Items.add(st3);
ListBox1.Items.add(st4);
end; |
Partager