Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
display any 10 numbers in ascending order using arrays in vb scripting
#2
Not Solved
Hi.. Please let me know if the below code works for you...

You would be required to pass/specify the numbers to the variable "InputNumbers"

'Code Starts Here

Code:
Option Explicit
Dim InputNumbers, SplitInputNumbers, ArrayCount, ReSort, iterInputNum, Num1, Num2
InputNumbers = "6,20,30,5,80,56,22,12,34,54"
SplitInputNumbers = Split(InputNumbers, ",")
ArrayCount = UBound(SplitInputNumbers)
ReSort = "YES"
While ReSort = "YES"
    ReSort = "NO"
    For iterInputNum = 0 to ArrayCount        
        If iterInputNum < ArrayCount Then
            If Cint(SplitInputNumbers(iterInputNum)) > Cint(SplitInputNumbers(iterInputNum+1)) Then
                Num1 = SplitInputNumbers(iterInputNum)
                Num2 = SplitInputNumbers(iterInputNum+1)
                SplitInputNumbers(iterInputNum+1) = Num1
                SplitInputNumbers(iterInputNum) = Num2
                ReSort = "YES"
            End If
        End If
    Next
Wend

'Code Ends Here


Thanks and Regards,
Swami
Reply


Messages In This Thread
RE: display any 10 numbers in ascending order using arrays in vb scripting - by v.swaminathan - 11-15-2011, 05:03 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  VB Scripting spixol 0 1,496 12-15-2019, 01:14 PM
Last Post: spixol
  QTP/UFT - Storing Multiple Arrays In An Array Eitel13 0 1,794 07-17-2018, 04:37 PM
Last Post: Eitel13
  VB scripting Aisha2015 0 2,377 08-07-2015, 02:21 PM
Last Post: Aisha2015
  Regarding Shell Scripting demoqtp 2 4,347 03-31-2015, 12:34 AM
Last Post: demoqtp
  How to read a text file using FSO from bottom to up order?? vallalarasu.p 0 2,505 10-13-2014, 11:14 AM
Last Post: vallalarasu.p

Forum Jump:


Users browsing this thread: 2 Guest(s)