To find the smallest value in a number of values may seem easy, but I think it is not that easy after all.
I've an array of float values. (Stored in Values[j])
I'm supposed to find the smallest value among all the values. After, finding the smallest value, I''m to find the second smallest value, next the third smallest value....etc
In the above codes, I'm able to get the smalest values....but to find the second smallest values and rest of the values will not be easy at all......Code:j=0; Smallest = Value[0]; for (j=0; j< MaxArrayValue ; j++){ if (Value[j+1] < Smallest ){ Smallest = Value [j+1]; }//End If }//End For
Note: I'm not arranging the values in ascending order, I'm getting the smallest values out so that I could perform some calculations without affecting the "already selected smallest value".
_____