decreasing order function with array?

I am writing a program that will ask the user for integers and then put them into descending order. I a close, but i don't know which numbers to put into my nested for loops. Right now it cuts off the highest number and im not sure why?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
 #include<iostream>
#include<iomanip>
#include<string>
#include<cmath>

using namespace std;

int i;
int j;
const int max = 10;
void hi_2_lo (int num[]);

int main()
{

	const int max = 10;

	int Jethro[max];
	string ans = "yes";

	while (ans == "yes")
	{


	cout<<"Please input ten integers to be put into descending order: "<<endl<<endl;
	
	for(i = 0; i < max; i++)
	{
	while(!(cin>>Jethro[i]))
		{ cin.clear();
      cin.ignore(10000,'\n');
	
	  cout<<"Please input only integers"<<endl;
	}
	}
	 
	
	cout<<endl<<endl;

	hi_2_lo(Jethro);

	for(i = 0; i<max; i++)
	{
		cout<<Jethro[i]<<endl;
	}
	cout<<"Thank you for using my program"<<endl;
	cout<<"Would you like to run this again? yes to proceed"<<endl;
	cout<<"anything else to end the program"<<endl;
	cin>>ans;
	}
	system("pause");
	return 0;
}

void hi_2_lo(int num[])
{
	int y = num[0];
	int low;

 for (i=0; i<10; i++) 
        for (j=9; j>-1; j--) {
            if(num[j-1] < num[j]) {
                low=num[j-1];
                num[j-1] = num[j];
                num[j] = low;
                }
 
		}
		return ;
}
Topic archived. No new replies allowed.