。 (2)上述加密算法對(duì)應(yīng)解密的VB程序代碼如下,請(qǐng)?jiān)跈M線處填入合適的代碼。 Private Sub commandl_click
Dim a As String,n As Integer,yw As String Dim i As Integer,j As Integer Dim index As Integer,k As Integer,x As Integer s=Tjye.ai1.jye.ai'文本框text中為待解密的字符串 m=Val(Text2.Text) n=Len(s) yw=″″ k=0 x=n/m For i=1 To
index=n-i+1 yw=yw+Mid(s,index,1) Forj=2 To m If
Then index=index-2*(x-i)-1 Else index=index-2*(i-1)-1 End If If Mid(s,index,1)=“#“Then
yw=yw+Mid(s,index,1) Next j Next i Label1.Caption=Mid(yw,1,Len(yw)-k) End Sub
(2)在橫線處補(bǔ)上代碼。 (3)有一句帶框框的代碼有誤,請(qǐng)修改為正確代碼,讓程序可以符合題意。 Dim(1 To 5)As Integer Dim n,k As Integer Private Sub Form_Load
n Val(Text1.Text):k=Val(Text2.Text) ’隨機(jī)生成n(n>=2)個(gè)不重復(fù)的0及以上的數(shù)字賦值給數(shù)組a,代碼略 End Sub Private Sub Command1_ Click
Dim m,1,r As Integer For i=1To n For j=1 To n-i Ifa(j)>a(j+1)Then t=a(j):a(j)=a(j+1):a(j+1)=t End If Next j Next i l=1:r=a(n)-a(1) Do While l<=r m=(1+r)\2 If
Then l=m+1 Else r=m-1 End If Loop Labell.Caption=Str(r) End Sub Function check (ByVal d As Integer) As Boolean Dim cow,rgt As Integer cow=1 rgt=a(1)+d Fori=2Ton If a(i)>=rgt Then. cow=cow+1
End If Next i If
Then check=True Else check=False End If End Function