Write the vb script for the lowest and highest values of an
array?
Answer Posted / pramod mallick
Dim x(5)
x(0) = 1
x(1) = 3
x(2) = 3
x(3) = 5
x(4) = 2
Dim y
Dim strArray
'Display
For y = LBound(x) To UBound(x)
strArray = strArray & x(y) & ","
Next
MsgBox "Before Sorting " & strArray
Dim z
'Demo loop
For z = LBound(x) To UBound(x)
For y = LBound(x) To UBound(x) - 1
Dim lower As Integer
Dim higher As Integer
If x(y) > x(y + 1) Then
higher = x(y)
lower = x(y + 1)
x(y) = lower
x(y + 1) = higher
ElseIf x(y) > x(y + 1) Then
higher = x(y)
lower = x(y + 1)
x(y) = lower
x(y + 1) = higher
Else 'equal
'do nothing
End If
Next
Next
'Display
strArray = ""
For y = LBound(x) To UBound(x)
strArray = strArray & x(y) & ","
Next
MsgBox "After sorting " & strArray
msgbox "Lowest is " & Lbound(x) & "Highest is " Ubound(x)
Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
Problem with XML checkpoint in QTP ?
Is there any pdf or online book for QTP Scripting? Let me know more about QTP Scripting.
how to fetch the values from grid? & qtp recogniges that grid as a webelement? what u do?
What is the difference between local and shared object repository in qtp?
Give the syntax to load function at run time.
What is the extension of the qtp local repository? If it is .mtr then what is .bdb extension stands for?
Have you used xml check point in your project?
how to find that tools work well with ur existing system?
How to carry out bit map check points in QTP
What is QTP testing process?
For which type of project the iterative model is suitable?
can any body give the banking domain concepts/links
what r the main attributes of test automation?
How many types of actions are there in quicktest professional (qtp)?
How many types of recording modes in qtp?