23 lines
546 B
Plaintext
23 lines
546 B
Plaintext
s$ = "nowhere ABJURER"
|
|
print " Cadena original : ", s$
|
|
print " Tras codificar : ", Rot13$(s$)
|
|
print "Tras decodificar : ", Rot13$(Rot13$(s$))
|
|
end
|
|
|
|
sub Rot13$ (s$)
|
|
local cad$
|
|
cad$ = ""
|
|
|
|
for i = 1 to len(s$)
|
|
temp = asc(mid$(s$, i, 1))
|
|
|
|
if temp >= 65 and temp <= 90 then // A to Z
|
|
temp = (mod((temp - 52), 26)) + 65
|
|
elsif temp >= 97 And temp <= 122 then // a to z
|
|
temp = (mod((temp - 84), 26)) + 97
|
|
end if
|
|
cad$ = cad$ + chr$(temp)
|
|
next i
|
|
return cad$
|
|
end sub
|