Rot-13: Difference between revisions

Added XBasic
imported>KayproKid
m (→‎{{header|An alternate approach}}: Code cleanup of 3rd S-BASIC approach)
(Added XBasic)
Line 967:
PRINT "After decoding : "; rot13$(s$)
END</syntaxhighlight>
 
==={{header|XBasic}}===
{{works with|Windows XBasic}}
<syntaxhighlight lang="qbasic">PROGRAM "Rot-13"
VERSION "0.0000"
 
DECLARE FUNCTION Entry ()
 
FUNCTION Entry ()
dec$ = ""
TYPE$ = "cleartext "
ctext$ = ""
iOffset = 13 'offset assumed to be 13 - uncomment line 11 to change
 
PRINT "For decrypt enter " + "<d> " + " -- else press enter > ";
dec$ = INLINE$("")
PRINT
 
IF LCASE$(dec$) = "d" THEN
iOffset = 26 - iOffset
TYPE$ = "ciphertext "
END IF
 
PRINT "Enter " + TYPE$; '' + "> ";
cad$ = UCASE$(INLINE$("> "))
 
FOR i = 1 TO LEN(cad$)
iTemp = ASC(MID$(cad$,i,1))
IF iTemp > 64 AND iTemp < 91 THEN
iTemp = ((iTemp - 65) + iOffset) MOD 26
PRINT CHR$(iTemp + 65);
END IF
NEXT i
END FUNCTION
END PROGRAM</syntaxhighlight>
 
=={{header|BASIC256}}==
2,122

edits