主题:大虾们帮我下
生成20个1到100之间的随机数,统计其中1位数、2位数和3位数的个数。
我编的是
Private Sub Command1_Click()
Dim a As Integer, i As Integer, c As Integer, d As Integer, e As Integer, f As Integer
Randomize
d = 0
e = 0
f = 0
For i = 1 To 20
a = Int(100 * Rnd) + 1
List1.AddItem a
c = Len(a)
If c = 1 Then
d = d + 1
ElseIf c = 2 Then
e = e + 1
Else
f = f + 1
End If
Text1.Text = d
Text2.Text = e
Text3.Text = f
Next i
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
List1.Clear
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
可是不知道是哪错了。。。。。
我编的是
Private Sub Command1_Click()
Dim a As Integer, i As Integer, c As Integer, d As Integer, e As Integer, f As Integer
Randomize
d = 0
e = 0
f = 0
For i = 1 To 20
a = Int(100 * Rnd) + 1
List1.AddItem a
c = Len(a)
If c = 1 Then
d = d + 1
ElseIf c = 2 Then
e = e + 1
Else
f = f + 1
End If
Text1.Text = d
Text2.Text = e
Text3.Text = f
Next i
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
List1.Clear
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
可是不知道是哪错了。。。。。