Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
29
Task/Rot-13/PureBasic/rot-13.basic
Normal file
29
Task/Rot-13/PureBasic/rot-13.basic
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue