Private sub Command1_click ( ) Dim s1AsString,s2As String,t AsString,ch As String Dim iAs Integer s1=Text1.Text i=Len(s1) t=““:s2=““Do While i>0 ch=Mid(s1,i,1) Ifch>=“0“And ch<=“9“Then t=ch+t Else s2=s2+t+, t=““End If i=i+1 Loop s2=s2+t Text2.Text=s2End sub
。 (2)實(shí)現(xiàn)上述功能的VB程序如下,請?jiān)跈M線處填入合適的代碼。Private Sub Command1_Click ( ?。?br />Dim bAs String,t As Integer,iAs Integer,c As Integer,d AsInteger t=0'可走路線計(jì)數(shù) For i=15To120'所有可走路線用十進(jìn)制枚舉 d=i c=0 b=““ Do While d<>0 If d Mod 2=1Then b=“1“+b c=c+1 If c>4Then Exit Do'若“1“的總數(shù)超過4個(gè)表示路線錯(cuò)誤,需退出Do循環(huán) Else ①
End If ②
Loop If c=4And Len(b)=7Then t=t+1 List1.AddItem b End If Next i Label1.Caption=Str(t)+“條“End Sub