|
-
Dec 6th, 1999, 08:50 PM
#1
Thread Starter
Member
I have an array of 7 values
1,4,4,5,8,8,8
I want to sort and use a bubble sort.
No problem
What I would like to know is how to increment any value that is equal to the one prior to it by 1.
When I incremnt the 3rd index(4) it becomes 5 and then the fourth index mathes the 3rd so it gets incremented and so on.
I would like to end up with
1,4,5,6,8,9,10
Thanks
-
Dec 6th, 1999, 10:23 PM
#2
here you go.
Code:
For intIndex = 0 To UBound(intArray) - 1
If intArray(intIndex) >= intArray(intIndex + 1) Then
intArray(intIndex + 1) = intArray(intIndex) + 1
End If
Next intIndex
------------------
Marty
-
Dec 6th, 1999, 10:27 PM
#3
This message has been deleted, since you got the reply from Marty.
------------------
Serge
Software Developer
[email protected]
[email protected]
ICQ#: 51055819
[This message has been edited by Serge (edited 12-07-1999).]
-
Dec 7th, 1999, 02:05 AM
#4
Thread Starter
Member
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
|