consumer48
New member
Hello. I'm have a project that requires me to compare a fixed length array:
, to a dynamic array like this one:
.
The thing is though, i want to compare each element of the first array with every element of the second array, and if i get a match do something, and delete the matched elements from the second array. Then, again, compare them, see that there are no matches, calculate the difference between the first element of the first array and the first element of the second array, and add it to all of the elements of array 1, therefore equalizing them so that they can be deleted once more. And so on... i'm gonna do an example below, because i don't know if i made any sense.
A1=(0,50,100,150)
A2=(0,100,150,200,250,300,350)
after comparison, 0=0, 100=100, and 150=150 => do something, then recreate the elements:
A1=(0,50,100,150)
A2=(200,250,300,350)
compare them again, there are no matches, so add 200(elem1-elem1 of each array) to the first array=>
A1=(200,250,300,350)
A2=(200,250,300,350)
now that i have a match, all element can be deleted, so the second array will be emptied . Basically, the first array empties the second one step by step, by equalizing the elements.
I'm sorry for the long post, but it's the only way i could have explained what i need. I really hope you guys can help me. Thank you!
Code:
dim fArray(3) as variant
fArray(0)=0
fArray(1)=50
fArray(2)=100
fArray(3)=150
Code:
dynArray(0)=0
dynArray(1)=100
dynArray(2)=150
dynArray(3)=200
dynArray(4)=250
dynArray(5)=300
dynArray(6)=350
The thing is though, i want to compare each element of the first array with every element of the second array, and if i get a match do something, and delete the matched elements from the second array. Then, again, compare them, see that there are no matches, calculate the difference between the first element of the first array and the first element of the second array, and add it to all of the elements of array 1, therefore equalizing them so that they can be deleted once more. And so on... i'm gonna do an example below, because i don't know if i made any sense.
A1=(0,50,100,150)
A2=(0,100,150,200,250,300,350)
after comparison, 0=0, 100=100, and 150=150 => do something, then recreate the elements:
A1=(0,50,100,150)
A2=(200,250,300,350)
compare them again, there are no matches, so add 200(elem1-elem1 of each array) to the first array=>
A1=(200,250,300,350)
A2=(200,250,300,350)
now that i have a match, all element can be deleted, so the second array will be emptied . Basically, the first array empties the second one step by step, by equalizing the elements.
I'm sorry for the long post, but it's the only way i could have explained what i need. I really hope you guys can help me. Thank you!