' Sort Data with Bubble Sort



arrSample = Array(4, 6, 2, 7, 3, 5, 1)
WScript.Echo vbCrLf & "array before"
For Each intNumber In arrSample
  WScript.Echo intNumber
Next
For i = LBound(arrSample) to UBound(arrSample)
  For j = LBound(arrSample) to UBound(arrSample)
    If j <> UBound(arrSample) Then
      If arrSample(j) > arrSample(j + 1) Then
         TempValue = arrSample(j + 1)
         arrSample(j + 1) = arrSample(j)
         arrSample(j) = TempValue
      End If
    End If
  Next
Next
WScript.Echo vbCrLf & "array after"
For Each intNumber In arrSample
  WScript.Echo intNumber
Next
search for scripts

VbsEdit contains all these sample scripts!


Download Now!



Download   Home   Scripts

Copyright © 2001-2024 adersοft