Can someone help me to output the numbers in the array that are user inputted and sort them in ascending order please this is the code i've come up with

so far it .... prompts the user no less then 50 elements and a value no more than 999

it doesnt.... output the elements and sorts them

```
#include <iostream.h>
#include <iomanip.h>
int sort(int [], int);
const int LIMIT = 50;
int MYARRAY[LIMIT];
int x,i,j,min,minx,temp,moves=0;
int value;
int main()
{
for(x=0;x<LIMIT;x++)
{
for(x=0;x<LIMIT;x++)
{
while(value < 999)
{
cout << "\n\nPlease enter a number: ";
cin >> MYARRAY[x];
value = value + MYARRAY[x];
moves = sort(MYARRAY, LIMIT);
}
cout << MYARRAY[LIMIT];
}
cout << "\n\nThe sorted list, in ascending order, is:\n";
cout << setw(4) << MYARRAY[LIMIT];
cout << endl << moves << " moves were made to sort this list\n";
}
return 0;
}
int sort(int a[], int n)
{
for(x=0;x<(LIMIT-1);x++)
{
min = MYARRAY[x];
minx = x;
for(j=x+1;j<i; j++)
{
if(MYARRAY[j] < min)
{
min = MYARRAY[j];
minx = j;
}
}
if (min < MYARRAY[x])
{
temp = MYARRAY[x];
MYARRAY[x] = min;
MYARRAY[minx]=temp;
moves++;
}
}
return moves;
}
```