Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
1
const TPolibius: array['A' .. 'E', 'A' .. 'E'] of char = ( ('A', 'B', 'C', 'D', 'E'), ('F', 'G', 'H', 'I', 'K'), ('L', 'M', 'N', 'O', 'P'), ('Q', 'R', 'S', 'T', 'U'), ('V', 'W', 'X', 'Y', 'Z') ); function PolibiusEncipher(toCode: string): string; var i: integer; ix, jx: char; s: string; begin s := ''; for i := 1 to length(toCode) do begin for ix := 'A' to 'E' do for jx := 'A' to 'E' do if TPolibius[ix, jx] = toCode[ i ] then begin s := s + ix + jx; break; end; end; PolibiusEncipher := s end; function PolibiusDecipher(toDecode: string): string; var i: integer; s: string; begin s := ''; i := 1; while i <= length(toDecode) do begin s := s + TPolibius[toDecode[ i ], toDecode[succ(i)]]; inc(i, 2); end; PolibiusDecipher := s end; var s: string; begin s := PolibiusEncipher('MOSCOW KREMLIN'); writeln(s); writeln('s = ', PolibiusDecipher(s)); end.
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
test27
Linha d'água de uma caixa retangular
Prosti brojevi praktikum nizovi
Elevador Versão Pascal StringList
basketball_player_training
Menezes
real vs integer
test02
Kim
Удвоенное число с одинаковыми цифрами
Please log in to post a comment.