Código de Pascal/Turbo Pascal - Codificar Texto

sin imagen de perfil

Codificar Textográfica de visualizaciones


Pascal/Turbo Pascal

Publicado el 12 de Marzo del 2002 por Gonzalo (3 códigos)
10.231 visualizaciones desde el 12 de Marzo del 2002
Coge el texo a codificar y le 'suma' una clave, con lo que tenemos el texto codificado. Si queremos el texto original tendremos que 'restarle' la clave que antes le habiamos sumado.

Versión 1
estrellaestrellaestrellaestrellaestrella(2)

Publicado el 12 de Marzo del 2002gráfica de visualizaciones de la versión: Versión 1
10.232 visualizaciones desde el 12 de Marzo del 2002
estrellaestrellaestrellaestrellaestrella
estrellaestrellaestrellaestrella
estrellaestrellaestrella
estrellaestrella
estrella

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
type
  cadena=string[80];
var
  f,d:file of byte;
  fuente,destino,claveStr:cadena;
  clave:array[0..80] of byte absolute claveStr;
  signo:byte;
  tecla:char;
 
function existe(fichero:cadena):boolean;
var
  f:file;
 
begin
  {$I-}
  assign(f,fichero);
  reset(f);
  {$I+}
  if IOResult=0 then
  begin
    close(f);
    existe:=true;
  end else existe:=false;
end;
 
procedure MAYUSCULAS(var frase:cadena);
var
  i:integer;
 
begin
  for i:=1 to length(frase) do
    if frase[i]='¤' then frase[i]:='¥' else frase[i]:=upcase(frase[i]);
end;
 
procedure leer(var opcion:char; op1,op2:char);
begin
  repeat
    read(kbd,opcion);
    opcion:=upCase(opcion);
  until opcion in [op1,op2];
  writeln(opcion);
end;
 
procedure continuar;
var
  car,i,long:byte;
 
begin
  assign(d,destino);
  rewrite(d);
  if signo=255 then writeln('Codificando fichero...') else
                    writeln('Descifrando fichero...');
  i:=1;
  long:=length(claveStr);
  while not eof(f) do
  begin
    read(f,car);
    car:=car+signo*clave[i];
    write(d,car);
    if i<long then i:=i+1 else i:=1;
  end;
  close(d);
end;
 
BEGIN
  write('Fuente : ');
  readln(fuente);
  MAYUSCULAS(fuente);
  if fuente<>'' then
  begin
    if existe(fuente) then
    begin
      assign(f,fuente);
      reset(f);
      write('Codificar o Descifrar C/D ');
      leer(tecla,'C','D');
      if tecla='C' then signo:=255 else signo:=1;
      write('Clave  : ');
      readln(claveStr);
      if claveStr<>'' then
      begin
        write('Destino: ');
        readln(destino);
        MAYUSCULAS(destino);
        if destino<>'' then
        begin
          if destino<>fuente then
          begin
            if existe(destino) then
            begin
              write('Fichero existente. ¨ Continuar ? S/N ');
              leer(tecla,'S','N');
              if tecla='S' then continuar;
            end else continuar;
          end else writeln('­ Deben ser distintos !');
        end;
      end;
      close(f);
    end else writeln('Fichero no encontrado.');
  end;
END.



Comentarios sobre la versión: Versión 1 (2)

31 de Julio del 2005
estrellaestrellaestrellaestrellaestrella
Ha realizado una valoración positiva de este curso.
Responder
julieta conte
31 de Agosto del 2015
estrellaestrellaestrellaestrellaestrella
No ha dejado ningún comentario
Responder

Comentar la versión: Versión 1

Nombre
Correo (no se visualiza en la web)
Valoración
Comentarios...
CerrarCerrar
CerrarCerrar
Cerrar

Tienes que ser un usuario registrado para poder insertar imágenes, archivos y/o videos.

Puedes registrarte o validarte desde aquí.

Codigo
Negrita
Subrayado
Tachado
Cursiva
Insertar enlace
Imagen externa
Emoticon
Tabular
Centrar
Titulo
Linea
Disminuir
Aumentar
Vista preliminar
sonreir
dientes
lengua
guiño
enfadado
confundido
llorar
avergonzado
sorprendido
triste
sol
estrella
jarra
camara
taza de cafe
email
beso
bombilla
amor
mal
bien
Es necesario revisar y aceptar las políticas de privacidad

http://lwp-l.com/s144