30 lines
592 B
Plaintext
30 lines
592 B
Plaintext
Declare.s Rot13(text_to_code.s)
|
|
|
|
If OpenConsole()
|
|
Define txt$
|
|
|
|
Print("Enter a string to encode: "): txt$=Input()
|
|
|
|
PrintN("Coded : "+Rot13(txt$))
|
|
PrintN("Decoded: "+Rot13(Rot13(txt$)))
|
|
|
|
Print("Press ENTER to quit."): Input()
|
|
CloseConsole()
|
|
EndIf
|
|
|
|
Procedure.s Rot13(s.s)
|
|
Protected.i i
|
|
Protected.s t, u
|
|
For i=1 To Len(s)
|
|
t=Mid(s,i,1)
|
|
Select Asc(t)
|
|
Case Asc("a") To Asc("m"), Asc("A") To Asc("M")
|
|
t=chr(Asc(t)+13)
|
|
Case Asc("n") To Asc("z"), Asc("N") To Asc("Z")
|
|
t=chr(Asc(t)-13)
|
|
EndSelect
|
|
u+t
|
|
Next
|
|
ProcedureReturn u
|
|
EndProcedure
|