Dim a(6, 6) As Integer For s = 0 To 5 '因为生成6组,0到5就行了 For s1 = 0 To 5 If s1 = 0 Or s1 = 2 Or s1 = 4 Then a(s, s1) = 0 Else a(s, s1) = Rnd * 100 End If Print a(s, s1) Next Next
方法2:意思一样的 换种写法,简便些
Dim a%(6, 6) For s = 0 To 5 For s1 = 0 To 5 Select Case s1 Case 0, 2, 4 a(s, s1) = 0 Case Else a(s, s1) = Rnd * 100 End Select Print a(s, s1) Next print Chr(13)'为了方便看,当一行完成后换行 输出换行符 Next