大连理工大学吧 关注:302,522贴子:7,078,486
  • 15回复贴,共1

【有没有VBA大神】VBA冒泡排序法大神们会吗

只看楼主收藏回复

没有的话我一会再来问一遍


来自Android客户端1楼2016-06-22 22:43回复
    晚上好


    IP属地:宁夏来自iPhone客户端2楼2016-06-22 22:46
    收起回复
      冒泡排序法是什么鬼。。


      IP属地:重庆来自Android客户端3楼2016-06-22 23:34
      收起回复
        不和c差不多嘛


        来自Android客户端4楼2016-06-22 23:38
        收起回复
          只会c


          来自iPhone客户端5楼2016-06-22 23:54
          收起回复
            '假设楼主懂VBA基础语法以及冒泡排序的原理
            Public Sub Bubble(ByRef longArray() As Long)
            Dim iOuter As Long
            Dim iInner As Long
            Dim iLBound As Long
            Dim iHBound As Long
            Dim iTemp As Long
            iLBound = LBound(longArray)
            iHBound = UBound(longArray)
            For iOuter = iLBound To iHBound - 1
            For iInner = iLBound To iHBound - iOuter - 1
            If longArray(iInner) > longArray(iInner + 1) Then
            iTemp = longArray(iInner)
            longArray(iInner) = olngArray(iInner + 1)
            longArray(iInner + 1) = iTemp
            End If
            Next iInner
            Next iOuter
            End Sub
            ‘有错误请轻喷,毕竟现学现卖>_<


            7楼2016-06-23 13:57
            回复