(1)如圖所示,該程序共有個對象。 (2)請根據(jù)題意將下列程序補充完整。 Private Sub Command1_Click ( ?。?br />Dim m As String,tmp As String,ch As String Dim s As String,i As Integer m=Text1.Text tmp=““ s=““ For i=1To Len(m) ch=Mid(m,i,1) If ch>=“0“And ch<=“9“Then ①
ElseIf tmp<>““Then s=s+tmp+“,“ ②
End If Next i
Text2.Text=s End Sub (3)輸入的文本信息如圖a所示,若刪除加框處代碼,則文本框Text2中顯示的內(nèi)容為
實現(xiàn)上述功能的VB程序如下,請回答下列問題。 (1)根據(jù)代碼可知,若要產(chǎn)生20個隨機數(shù),只需將的值修改為20即可。 (2)請在橫線處填入合適代碼。 Const n=10 Dim a(1To n) As Integer Private Sub Command1_Click ( )’素數(shù)遷移模塊 Dim i As Integer List1.Clear’清除列表框 List2.Clear For i=1To n For j=2To a(i)-1 If ①
Then Exit For’Exit For的功能是退出For循環(huán) End If Next j If ②
Then List2.AddItem Str(a(i)) Else List1.AddItem Str(a(i)) End If Next i End Sub Private Sub Form_Load ( ?。S機數(shù)初始化模塊 Randomize’隨機數(shù)種子初始化 For i=1To n a(i)=③