Skip to content

Caesar cipher

Pascal character shift

Flowchart (ISO 5807)

StartInput s, kr = «»i = 1, |s|, 1r = r + chr(ord(s[i]) + k)caesar = rEndFigure 1 — caesar

Source code

Pascal
function caesar(s: string; k: integer): string;
var i: integer;
    r: string;
begin
  r := '';
  for i := 1 to length(s) do
    r := r + chr(ord(s[i]) + k);
  caesar := r;
end;

The editor opens with this code — change it and the chart redraws.

Language
Pascal
Constructs
character shift
Topic
Algorithms
Formats
Word, Visio, draw.io, PDF, SVG

Related examples