Private Sub Form_Click()
Cls
Dim n As Integer
Randomize
For i = 1 To 10
For j = 1 To 10
n = Int(Rnd * 900 + 100)
If n Mod 3 = 0 Then
Me.ForeColor = vbRed
Print n;
Else
Me.ForeColor = vbBlack
End If
Print n;
Next j
Print
Next i
End Sub
Private Sub Form_Load()
Me.AutoRedraw = True
End Sub
追问你真棒,可以教教我怎么学vb吗
追答Private Sub Form_Click()'这个是有排序的
Dim a(1 To 100) As Integer
Dim k As Integer, b As Integer
Cls
Randomize
For i = 1 To 100
a(i) = Int(Rnd * 900 + 100)
Next i
For i = 1 To 100
For j = i + 1 To 100
If a(i) < a(j) Then
b = a(i): a(i) = a(j): a(j) = b
End If
Next j
Next i
For i = 1 To 10
For j = 1 To 10
If a((i - 1) * 10 + j) Mod 3 = 0 Then
Me.ForeColor = vbRed
Print a((i - 1) * 10 + j);
Else
Me.ForeColor = vbBlack
End If
Print a((i - 1) * 10 + j);
Next j
Print
Next i
End Sub
Private Sub Form_Load()
Me.AutoRedraw = True
End Sub
追问什么意思?
就是下面这个是正确答案?
追答上面那个忘了排序了,从大到小。
追问好,明白了