實(shí)現(xiàn)上述功能的VB程序如下: Private Sub Command1_Click ( ?。?br />Dim a(1To 1000)As String'數(shù)組a存儲(chǔ)文中出現(xiàn)該指定單詞(或字符串)的各個(gè)位置 Dim s As String,c As String,ch As String Dim n As Integer,max As Integer,i As Integer s=Text1.Text c=Text2.Text n=0:Max=0 For i=1To Len(s)-Len(c)+1 ch=① If ch=c Then n=n+1 a(n)=i If n>=2Then If a(n)-a(n-1)-Len(c)>Max Then Max=a(n)-a(n-1)-Len(c) End If End If Next i Text3.Text=② End Sub 以上程序段運(yùn)行時(shí),為了實(shí)現(xiàn)上述功能,橫線處①和②應(yīng)填入的代碼分別為: (1)
解決此問題的部分程序段如下: Const n=500'設(shè)卡號(hào)總數(shù)為500 Dim zg(1To n) As Long Dim ye(1To n) As Single Private Sub Form1_Load ( ?。?br />'此過程用于對(duì)數(shù)組zg和數(shù)組ye進(jìn)行初始賦值,代碼略 End Sub Private Sub Command1_Click ( ?。?br />Dim x As Long,i As Long,j As Long,m As Long,find As Boolean x=Val(Text1.Text) i=1:j=n:find=False Do While ① ② If x=zg(m) Then ③ ElseIf x<zg(m) Then j=m-1 Else i=m+1 End If Loop If find=true Then Lab3.Caption=″此卡號(hào)余額為″+Str(ye(m))+″元″ Else Lab3.Caption=″找不到此卡號(hào),請(qǐng)重新輸入″ End If End Sub 在程序①、②、③橫線處填入適當(dāng)?shù)恼Z句或表達(dá)式.將程序補(bǔ)充完整: (1)程序中①橫線處應(yīng)填入