Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
Can anyone help me?
I've got an array of 10 accending numbers that go from from 1 to 3000. I want to find what the biggest number thats less than or equal to 2000. e.g. if the array was 1,10,27,200,422,1500,1999,2500,2950, 3000 I would want the number 1999 and its index (6).
Thanks
Thanks
There are an issue -call it a bug- after reading better the post. Attached finds the closer and the closer by the left to a number in a vector.
Regards. Alvaro.
There are an issue -call it a bug- after reading better the post.
I'm not sure what your getting at?
Is it because I slightly modified Alan's function? All I was trying to do was to show a different way to iterate through the vector.
Mike
Alan's function and your modification it's ok. What is not is my first post: it searches for the closser in the vector, the title of the original post talk about the biggest but actually wanted result is the closser but by the left. What I modify was my first post, adding the requested search. But Alan implementation, and yours, are ok too.
Regards. Alvaro.