|
-
Aug 4th, 2000, 12:19 PM
#1
Thread Starter
New Member
If you have an array of numbers is there any command that returns the greatest value in the array?
-
Aug 4th, 2000, 12:23 PM
#2
transcendental analytic
Ubound(arrayname) returns upper bound
Lbound(arrayname) returns lower bound
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 4th, 2000, 12:26 PM
#3
Fanatic Member
FOr me your question says: how to find the greatest number in an array not the number of items in an array. If that the case then something like this would do it:
Code:
Option Explicit
Private Sub Form_Load()
Dim MyArray(1 To 6) As Integer
Dim I As Integer
Dim Temp As Integer
For I = 1 To 6
MyArray(I) = I
If I = 6 Then
MyArray(I) = 34
End If
Next I
Temp = MyArray(1)
For I = 2 To UBound(MyArray)
If Temp < MyArray(I) Then
Temp = MyArray(I)
End If
Next I
MsgBox Temp '//Returns 34
End Sub
-
Aug 4th, 2000, 12:26 PM
#4
Frenzied Member
Nothing to stop you from writing your own
dim i as int
dim max_value as long 'or whatver the array value is defined
max_value=0
for i=1 to ubound(array_num)
if array_num(i) > max_value then max_value=array_num(i)
next i
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|