比较5个数大小,输出最小的一个,这个代码应该如何写呀,请大家帮帮忙

解决方案 »

  1.   

    http://zhidao.baidu.com/question/9178493.html
      

  2.   

    传入数组,传出最大和最小值的函数Private Sub Swap(intList() As Integer, ByRef intMax As Integer, ByRef intMin As Integer)
        Dim intIndex As Integer
        intMax = intList(0)
        intMin = intList(0)    For intIndex = 0 To UBound(intList) - 1
            If intList(intIndex) > intMax Then
                intMax = intList(intIndex)
            End If
            If intList(intIndex) < intMin Then
                intMin = intList(intIndex)
            End If
        Next
    End Sub
      

  3.   

    dim a (1 to 10) as integer 
    dim temp as integer 
    for i=1 to a.lenth 
    if temp>a(i) 
    temp=a(i) 
    next 
    print temp
      

  4.   

    如果是非浮点数,数据都大于0,而且不是很大可以试试不排序的办法(字节型的最好,呵呵)
    dim data(4) as byte'这里放置五个要排序的数据dim d() as byte
    dim i as long
    for i=0 to 4
       redim preserve d(data(i))
       d(data(i))=data(i)
    next
    for i=0 to ubound(d)
       if d(i)>0 then 
           debug.print d(i)
           exit for
       end if
    next