Manufacturing Information Solutions Forum Index Manufacturing Information Solutions
Your Place for Support and Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sort Data with Bubble Sort

 
Post new topic   Reply to topic    Manufacturing Information Solutions Forum Index -> VB Script
View previous topic :: View next topic  
Author Message
mistux
Site Admin


Joined: 25 Jun 2004
Posts: 1042
Location: South Bend, Indiana USA

PostPosted: Fri May 02, 2008 1:59 pm    Post subject: Sort Data with Bubble Sort Reply with quote

Code:
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
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Manufacturing Information Solutions Forum Index -> VB Script All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group