VB程序设计有点问题~急

来源:百度知道 编辑:UC知道 时间:2024/06/07 09:24:53
是一个加密和解密的程序
Public Function crypt()
Dim i, s, sl, g As Integer
Dim crypted As String
On Error Resume Next
For i = 1 To Len(x)
s = Asc(Mid(x, i, 1))
s1 = s1 + s
Next
s1 = Int((s1 * 0.1) / 6)
x = s1
g = 0
For i = 1 To Rnd
s = Asc(Mid(Rnd, i, 1))
g = g + 1
If g = 6 Then g = 0
s1 = 0
If g = 0 Then s1 = s - (x - 2)
If g = 1 Then s1 = s + (x - 5)
If g = 2 Then s1 = s - (x - 4)
If g = 3 Then s1 = s + (x - 2)
If g = 4 Then s1 = s - (x - 3)
If g = 5 Then s1 = s + (x - 5)
s1 = s1 + g
crypted = crypted & Chr(s1)
Next
crypt = crypted
End Function
Public Function decrypt()
Dim i, s, sl, g As Integer
Dim decrypted As String
On Error Resume Next
For i = 1 To Len(x)
s = Asc(Mid(x, i, 1))
s1 = s1 + s
Next
s1 = Int((s1 * 0.1) / 6)
x = s1
g = 0
For i = 1 To Rnd
s

crypt函数定义时没有定义传递参数的名称和类型,函数本身也没有返回类型。
问题很多。

以下回答是针对提问者的补充内容:
比如
public function crypt(a as String,b as String) as String
你可参考一些VB的教学书籍,语法是基础的,至于你的加密解密的算法,就无能为力了。抱歉。