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
How to find the length of the string in qtp?
Hi friends I need to know about jubula automation tool. Is anybody know in bangalore where jubula tanning class is going on do let me know. Its urgent for me to learn that tool please help.
What is RTM (require ment tracebulity marix) fromate?
In keyward driven framework what will be the step for yahoo login page ,inbox logout,plz explain in detail
How to define array in qtp?
Hi frens! I am testing VB project with MS Access database. At add button click my record is storing in data table and it is shown in datagrid. So at Delete button click i want to check datagrid rows 9before and after delete). so how can i do it using descriptive programming?
what are the critical test cases in crm? tell me atleast 5 critical test cases? what are the critical bug u find out while testing crm domain?
Can anyone help.i need total excelsheet operations,shortcuts in testing environment from starting onwards....
Which functionalities of QTP used in banking project? pls any say answer?
What is environment variable in qtp and why to use it?
write a script to verify the image path(src property) of the images which are in web pages.
What are the different types of checkpoints?
How to creating an output value using quicktest professional (qtp)?
When and why to use descriptive programming?
What is QTP’s model for test creation?