Caesar cipher: Difference between revisions
Content added Content deleted
(→Insitux: implementation) |
Hendursaga (talk | contribs) m (Fix misspellings of Caesar.) |
||
Line 3,197: | Line 3,197: | ||
</syntaxhighlight> |
</syntaxhighlight> |
||
=={{header|Forth}}== |
=={{header|Forth}}== |
||
<syntaxhighlight lang="forth">: |
<syntaxhighlight lang="forth">: caesar ( c n -- c ) |
||
over 32 or [char] a - |
over 32 or [char] a - |
||
dup 0 26 within if |
dup 0 26 within if |
||
Line 3,203: | Line 3,203: | ||
else 2drop then ; |
else 2drop then ; |
||
: |
: caesar-string ( n str len -- ) |
||
over + swap do i c@ over |
over + swap do i c@ over caesar i c! loop drop ; |
||
: |
: caesar-inverse ( n -- 'n ) 26 swap - 26 mod ; |
||
2variable test |
2variable test |
||
s" The five boxing wizards jump quickly!" test 2! |
s" The five boxing wizards jump quickly!" test 2! |
||
3 test 2@ |
3 test 2@ caesar-string |
||
test 2@ cr type |
test 2@ cr type |
||
3 |
3 caesar-inverse test 2@ caesar-string |
||
test 2@ cr type</syntaxhighlight> |
test 2@ cr type</syntaxhighlight> |
||
=={{header|Fortran}}== |
=={{header|Fortran}}== |
||
{{works with|Fortan 90 and later}} |
{{works with|Fortan 90 and later}} |