在文本框里每个数字以 空格 为分界 Private Sub Command1_Click() Dim A(10) As Integer Randomize For I = 0 To 9 A(I) = Int(Rnd * 81 + 20) Print A(I) & Space(1);
Next I Print Print "排列后" For I = 0 To 8 For J = I + 1 To 9 If A(I) > A(J) Then temp = A(I): A(I) = A(J): A(J) = temp Next J Next I For I = 0 To 9 Print A(I) & Space(1); Next End Sub
Private Sub Command2_Click() t = Split(Text1, " ") Print "偶数为" For I = 0 To UBound(t) - 1 If Val(t(I)) Mod 2 = 0 Then
Print t(I) & Space(1); Sum = Sum + Val(t(I)) End If Next Print Print "偶数和:" & Sum End Sub