Computer Science Blog

June 12, 2007

Program Enkripsi

Filed under: Pascal Programming

Program enkripsi;

{program Caesar chiper}

uses wincrt;

var
   kalimat : string;
   i :  byte;
   ch : char;

begin
     write(’masukkan suatu kalimat : ‘);readln(kalimat);

     writeln;
     write(’Hasil enkripsi : ‘);
     for i:=1 to length(kalimat) do
        
         begin
         if kalimat[i] in [’A’..’Z'] then
         begin
            ch := chr(ord(kalimat[i])+5); 
            if ord(ch) > 90 then
               ch := chr(ord(ch)-26);
         end
         else  if kalimat[i] in [’a’..’z'] then
         begin
            ch := chr(ord(kalimat[i])+5);
            if ord(ch) > 122 then
               ch := chr(ord(ch)-26);
         end
         else
             ch := kalimat[i];
         write(ch);
         end;

     readkey;
     donewincrt;
end.

Comments »

The URI to TrackBack this entry is: http://gudeg.blogsome.com/2007/06/12/program-enkripsi/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.

Get free blog up and running in minutes with Blogsome
Theme designed by Jay of onefinejay.com