1吧 关注:148,299贴子:324,212
  • 5回复贴,共1
Private Sub Command1_Click()
Dim a(1 To 10) As Integer, b As Integer, c As Integer, d As Integer
Cls
For b = 1 To 10
     a(b) = InputBox("input number", "input", 0)
Next b
c = a(1)
For b = 1 To 10
     If a(b) > c Then
         c = a(b)
         d = b
     End If
Next b
b = a(1)
a(1) = c
a(d) = b
For b = 1 To 10
     If a(b) < c Then
         c = a(b)
         d = b
     End If
Next b
b = a(10)
a(10) = c
a(d) = b
For b = 1 To 10
     Print a(b)
Next b
End Sub


1楼2011-04-07 18:29回复
    第四题
    Private Sub Command1_Click()
    Dim a As Integer, b As Integer, c As Integer, d As Integer
    Cls
    a = Val(InputBox("input n", "input", 0))
    ReDim k(a) As Integer
    For b = 1 To a
         k(b) = InputBox("input a" & b, "input", 0)
         c = c + k(b)
    Next b
    c = c / a
    For b = 1 To a
         d = d + (k(b) - c) ^ 2
    Next b
    Print Sqr(d) / a
    End Sub
    


    2楼2011-04-07 19:34
    回复
      第三题
      Private Sub Command1_Click()
      Dim a(30) As Integer, b As Integer, c As Integer, d As Integer, e As Integer
      Randomize
      For b = 1 To 30
           a(b) = Int(Rnd * 1000)
      Next b
      For b = 1 To 29
           c = b
           For d = b + 1 To 30
               If a(c) > a(d) Then
                   c = d
               End If
           Next d
           e = a(c)
           a(c) = a(b)
           a(b) = e
      Next b
      For b = 1 To 30
           Print a(b)
      Next b
      End Sub
      


      3楼2011-04-07 19:35
      回复
        Private Sub Command1_Click()
        Dim a(10) As Integer, b(10) As Integer, c As Integer, k As Integer, j As Integer
        Cls
        For c = 1 To 10
             a(c) = InputBox("input number", "input", 0)
             j = Abs(a(c))
             For k = 0 To 5
                 b(c) = b(c) + (j Mod 10)
                 j = j \ 10
             Next k
        Next c
        For c = 1 To 10
             Print a(c); ";";
        Next c
        Print
        For c = 1 To 10
             Print b(c); ";";
        Next c
        End Sub
        第二题


        4楼2011-04-07 19:56
        回复
          我.. 这些个是什么呢


          5楼2011-04-08 03:13
          回复
            回复:5楼
            如题某天的VB作业而已


            6楼2011-04-08 21:12
            回复