program Criptografia1;
uses crt;
var
texto : string;
function cripto(txt : string):string;
var i : integer;
c : integer;
begin
for i := 1 to length(txt) do
begin
c:= ord(txt[i]);
if(c>=65)and(c<=90) then
begin
c:= c+3;
if(c>90)then
c := c - 26;
txt[i] := chr(c);
end;
end;
cripto := txt;
end;
function decripto(txt : string):string;
var i : integer;
c : integer;
begin
for i := 1 to length(txt) do
begin
c:= ord(txt[i]);
if(c>=65)and(c<=90) then
begin
c:= c-3;
if(c<65)then
c := c + 26;
txt[i] := chr(c);
end;
end;
decripto := txt;
end;
begin
write('Digite um Texto: ');
readln (texto);
texto := upcase(texto);
texto := cripto(texto);
writeln('Criptografia do Texto ',texto);
texto := decripto(texto);
writeln(' Normal ', texto);
readkey;
end.
tem como explicar?!
ResponderExcluir