Private Sub Command1_Click() Dim S1 As String, S2 As String Dim I1 As Integer ' S1 = ? I1 = 1 Do ' Do While Mid(S1, I1, 1) <> ? And I1 <= Len(S1) S2 = S2 & Mid(S1, I1, 1) I1 = I1 + 1 Loop ' List1.AddItem ? ' S2 = ? I1 = I1 + 1 Loop While I1 <= Len(S1) End Sub
查看答案
Private Sub Command1_Click() Dim S1 As String, S2 As String Dim I1 As Integer S1 = Text1.Text I1 = 1 Do Do While Mid(S1, I1, 1) <> " " And I1 <= Len(S1) S2 = S2 & Mid(S1, I1, 1) I1 = I1 + 1 Loop List1.AddItem S2 S2 = "" I1 = I1 + 1 Loop While I1 <= Len(S1) End Sub
Private Sub C1_Click() 'Dim flag As Boolean '题目: 'For i = 0 To ? ' If Cb1.List(i) = ? Then ' flag = True ' Else ' flag = False ' End If 'Next 'If flag Then ' MsgBox "已有此项" ' Cb1.Text = "" 'Else ' Cb1. ? Cb1.Text 'End If
查看答案
'正确程序: Dim flag As Boolean For i = 0 To Cb1.ListCount - 1 If Cb1.List(i) = Cb1.Text Then flag = True Else flag = False End If Next If flag Then MsgBox "已有此项" Cb1.Text = "" Else Cb1.AddItem Cb1.Text End If End Sub '答案: 'Cb1.ListCount - 1 'Cb1.Text 'AddItem
Private Sub C1_Click() Open "out5.txt" For Output As #1 Print #1, Text1.Text Close #1 End Sub
查看答案
Private Sub Form_Load() Open "in5.txt" For Input As #1 Text1.Text = "" Do While Not EOF(1) Line Input #1, a$ Text1.Text = Text1.Text + a$ + Chr(13) + Chr(10) Loop Close #1 End Sub
'提供给考生的程序 Private Sub Form_Unload(Cancel As Integer) Open App.Path & "\out4.txt" For Output As #1 Print #1, Ch1.Value, Ch2.Value, Text1.Text Close #1 End Sub
查看答案
'需要考生编写的程序 Private Sub C1_Click() Text1.Text = "我选的课是" If Ch1.Value Then Text1.Text = Text1.Text + Ch1.Caption End If If Ch2.Value = 1 Then Text1.Text = Text1.Text + Ch2.Caption End If End Sub
'提供给考生的程序 Private Function isprime(a As Integer) As Boolean Dim flag As Boolean flag = True b% = 2 Do While b% <= Int(a / 2) And flag If Int(a / b%) = a / b% Then flag = False Else b% = b% + 1 End If Loop isprime = flag End Function
查看答案
'要求考生编写的程序 Private Sub C1_Click() Open "in5.txt" For Input As #1 Input #1, a% Close #1 Text1.Text = a% End Sub Private Sub C2_Click() a% = Text1.Text Do a% = a% + 1 Loop Until isprime(a%) Text2.Text = a% End Sub Private Sub C3_Click() Open "out5.txt" For Output As #1 Print #1, Text2.Text Close #1 End Sub