0

Hey, I need some help inserting into a function and sorting the 10 user input numbers, I'm close, but I get zeros every time.

Here is my code:

```
#include <iostream.h>
void InsertIntoArray (int[], int, int, int);
int whichSlot (int[], int, int);
int main()
{
int num;
int times;
const int arraysize=10;
int array[arraysize] = {0};
times = 0;
while (times <= 10) //Ask for another number when there are less than 10 numbers in the array
{
cout << "Please enter your number!" << endl;
cin >> num;
times++;
int result = whichSlot(array, num, times);
InsertIntoArray(array, num, times, result);
}
for ( int j = 0; j < arraysize; j++ )
{
cout << array[ j ] << endl;
}
return 0;
}
int whichSlot (int array[], int num, int times)
{
if (times == 0)
{
return 0;
}
if (num >= array[times-1])
{
return times;
}
for (int i=0; i<times; i++)
{
if (num <= array[i])
{
return i;
}
}
}
void InsertIntoArray (int array[], int num, int times, int result)
{
num = array[result];
return;
}
```