langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
21
Task/Caesar-cipher/Run-BASIC/caesar-cipher.run
Normal file
21
Task/Caesar-cipher/Run-BASIC/caesar-cipher.run
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
input "Gimme a ofset:";ofst ' set any offset you like
|
||||
|
||||
a$ = "Pack my box with five dozen liquor jugs"
|
||||
print " Original: ";a$
|
||||
a$ = cipher$(a$,ofst)
|
||||
print "Encrypted: ";a$
|
||||
print "Decrypted: ";cipher$(a$,ofst+6)
|
||||
|
||||
FUNCTION cipher$(a$,ofst)
|
||||
for i = 1 to len(a$)
|
||||
aa$ = mid$(a$,i,1)
|
||||
code$ = " "
|
||||
if aa$ <> " " then
|
||||
ua$ = upper$(aa$)
|
||||
a = asc(ua$) - 64
|
||||
code$ = chr$((((a mod 26) + ofst) mod 26) + 65)
|
||||
if ua$ <> aa$ then code$ = lower$(code$)
|
||||
end if
|
||||
cipher$ = cipher$;code$
|
||||
next i
|
||||
END FUNCTION
|
||||
Loading…
Add table
Add a link
Reference in a new issue