Write the vb script for the lowest and highest values of an
array?
Answer / 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 |
how to convert 100 into hundred repees only and viceversa
HOW to invoke any recorded script in QTP with out using RECORD & PLAYBACK CONCEPT?
What is QTP and the use of QTP in TD?
What is the difference between Datadriven and Parameterization?
Diff b/w test scenario's and test Procedures?
How to find Total no of Text Fields in the Page..Anybody please answer me..Thanks in Advance
What is object & properties (in QTP)
Explain the concept of object repository and how QTP recognizes objects?
As u told write Libarary files in QTP. Do u use ever oject repositary 0r spy while writing scripts and for which type of testing u prepared test scripts.
how to capture tool tip in QTP and which check point is needed
Is virtual object supported in low level recording mode?
What is the Limitations of Testing ?