I'm writing a function that stores a number into an array. If the number is greater that the lowest number in the array then it replaces it. The array size is 10. When the number is stored in the array. The lowest number must then be remove. How do I write this?
void InsertNumber(int List[], unsignedint Size, int Number)
{
//check if size of array is zero, if it is, return
if(Size == 0 ) return;
int LowNumber = List[0]; //the lowest number
int LowNumberIndex = 0; //the index that its found
//check for lowest number
for(int x = 0; x < Size; x++)
{
if(List[] < LowNumber)
{
LowNumber = List[x];
LowNumberIndex = x;
}
}
//if the number is lower then the lowest number in the array return.
if(Number <= LowNumber) return;
List[LowNumberIndex] = Number;
};