實(shí)現(xiàn)上述功能的VB程序如下,請(qǐng)?jiān)跈M線處填入合適的代碼. Private Sub Command1_Click ( ) Dim i As Integer,t As Integer,c As Integer Dim flag As Boolean c=0 For i=1001To 9999Step 2 t=i flag=True Do While t<>0 If ① Then flag=False Exit Do End If t=t\10 Loop If flag Then List1.AddItem Str(i) ② End If Next i Label1.Caption=“四位超級(jí)素?cái)?shù)共有“+Str(c)+“個(gè)“ End Sub Function prime(x As Integer) As Boolean Dim i As Integer prime=True For i=2To x-1 If ③ Then prime=False Exit Function End If Next i End Function (1)①處的代碼為
. (2)具體的VB程序如下,請(qǐng)?jiān)跈M線處填入合適代碼. Private Sub Command1_Click ( ) Dim s As String,i As Integer Dim str As String,ch As String List1.Clear str=Text1.Text For i=1To Len(str)
s=convert(ch) List1.AddItem ch &“→“& s Next i End Sub Private Function convert(ch As String) As String Dim m As Integer,k As Integer,n As Integer,i As Integer,s As String s=““ n=Asc(ch) Do While n>0
s=m & s If m=1Then k=k+1 End If n=n\2 Loop For i=1To 7-Len(s) s=“0“& s Next i If k Mod 2=0Then s=“1“& s Else s=“0“& s End If