从零开始 2013-05-08
代码如下:
明文字母表:ABCDEFGHIJKLMNOPQRSTUVWXYZ 密文字母表:DEFGHIJKLMNOPQRSTUVWXYZABC
代码如下:
Function Caesar(str,offset) Dim length,char,i Caesar = "" length = Len(str) For i = 1 To length char = Mid(str,i,1) If char >= "A" And char <= "Z" Then char = Asc("A") + (Asc(char) - Asc("A") + offset) Mod 26 Caesar = Caesar & Chr(char) ElseIf char >= "a" And char <= "z" Then char = Asc("a") + (Asc(char) - Asc("a") + offset) Mod 26 Caesar = Caesar & Chr(char) Else Caesar = Caesar & char End If Next End Function WScript.Echo Caesar("ABCDEFGHIJKLMNOPQRSTUVWXYZ",3)