Paste: Rot13

Author: mbishop
Mode: ada95
Date: Mon, 12 Jan 2009 22:49:24
Plain Text |
with Ada.Text_IO; use Ada.Text_IO;

procedure Rot13 is
   C : Character;

begin
   while not End_Of_File(Standard_Input) loop
      Get(C);
      if (C >= 'A' and C <= 'M') or (C >= 'a' and C <= 'm') then
         C := Character'Val(Character'Pos(C) + 13);
      elsif (C >= 'N' and C <= 'Z') or (C >= 'n' and C <= 'z') then
         C := Character'Val(Character'Pos(C) - 13);
      end if;
      Put(C);
   end loop;
end;

New Annotation

Summary:
Author:
Mode:
Body: