tasks a-s

This commit is contained in:
Ingy döt Net 2013-04-10 23:57:08 -07:00
parent 47bf37c096
commit b83f433714
12433 changed files with 156208 additions and 123 deletions

View file

@ -0,0 +1,29 @@
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