none
这段代码为什么比较大小的时候会出错,有没人帮我指点下,谢谢 RRS feed

  • 问题

  • 这段代码为什么比较的时候不能按顺序排列,求指点,谢谢!

    Private Sub Command1_Click()
    Cls
    Open "c:\number.txt" For Output As #1
    Close #1
    Dim i As Integer, j As Integer, m As Integer ', n As Integer
    Dim a(1 To 7) As Integer, tempnod As Integer
    Do
    n = InputBox("请输入投注数目", "投注提示框")
    Loop While n < 1 Or n > 100
    For m = 1 To Int(n)
      For i = 1 To 6
          Randomize
          a(i) = Int(Rnd * 32 + 1)
        For j = 1 To i - 1
          Do While a(i) = a(j)
            Randomize
            a(i) = Int(Rnd * 32 + 1)
          Loop
          If a(i) < a(j) Then
            tempnod = a(i)
            a(i) = a(j)
            a(j) = tempnod
          End If
        Next j
      Next i
    Randomize
    a(7) = Int(Rnd * 16 + 1)
    Form1.Scale (0, 100)-(100, 0)
    CurrentX = 10
    CurrentY = 80 - 5 * m
    Print a(1), a(2), a(3), a(4), a(5), a(6), a(7)
    'Print a(1); Tab(4); a(2); Tab(8); a(3); Tab(12); a(4); Tab(16); a(5); Tab(20); a(6); Tab(24); a(7)
    Open "c:\number.txt" For Append As #1
    Print #1, a(1), a(2), a(3), a(4), a(5), a(6), a(7)
    Close #1
    Next m
    End Sub

     

    2011年7月23日 4:55

答案

全部回复