C's method of getting the maximum and minimum values in an array
- 2021-06-28 13:40:39
- OfStack
Obtain the maximum and minimum values in the array from the following functions.Pass Array Range 1 float Type Variable Directly on Call
public float MaxOfList(float[] flotNum)
{
float maxValue = flotNum.ToArray().Max();
return maxValue;
}
public float MinOfList(float[] flotNum)
{
float minValue = flotNum.ToArray().Max();
for (int i = 0; i < flotNum.Length; ++i)
{
if ((flotNum[i] > -9999.0f) && (minValue > flotNum[i]))
{
minValue = flotNum[i];
}
}
return minValue;
}