Caesar cipher: Difference between revisions

Content added Content deleted
m (BASIC256 and BBC BASIC moved to the BASIC section.)
(Caesar cipher in Chipmunk Basic)
Line 1,014: Line 1,014:
Zkmu wi lyh gsdr psfo nyjox vsaeyb teqc
Zkmu wi lyh gsdr psfo nyjox vsaeyb teqc
Pack my box with five dozen liquor jugs</pre>
Pack my box with five dozen liquor jugs</pre>

==={{header|Chipmunk Basic}}===
{{works with|Chipmunk Basic|3.6.4}}
{{trans|BASIC256}}
<syntaxhighlight lang="qbasic">
10 rem Caesar cipher
20 cls
30 dec$ = ""
40 type$ = "cleartext "
50 print "If decrypting enter "+"<d> "+" -- else press enter "; : input dec$
60 input "Enter offset > ",ioffset
70 if dec$ = "d" then
80 ioffset = 26-ioffset
90 type$ = "ciphertext "
100 endif
110 print "Enter "+type$+"> ";
120 input cad$
130 cad$ = ucase$(cad$)
140 longitud = len(cad$)
150 for i = 1 to longitud
160 itemp = asc(mid$(cad$,i,1))
170 if itemp > 64 and itemp < 91 then
180 itemp = ((itemp-65)+ioffset) mod 26
190 print chr$(itemp+65);
200 else
210 print chr$(itemp);
220 endif
230 next i
240 print
250 end
</syntaxhighlight>
{{OUT}}
<pre> >run
If decrypting enter <d> -- else press enter ?
Enter offset > 21
Enter cleartext > ? My hovercraft is full of eels.
HT CJQZMXMVAO DN APGG JA ZZGN.
>run
If decrypting enter <d> -- else press enter ? d
Enter offset > 21
Enter ciphertext > ? HT CJQZMXMVAO DN APGG JA ZZGN.
MY HOVERCRAFT IS FULL OF EELS.</pre>

=={{header|Beads}}==
=={{header|Beads}}==
<syntaxhighlight lang="beads">beads 1 program 'Caesar cipher'
<syntaxhighlight lang="beads">beads 1 program 'Caesar cipher'