Modify rainfall program

Hello, I have to modify a rainfall program that I have previously made last quarter, and make it display a list of months sorted in order from high to low and I'm not sure where to begin. Any help is greatly appreciated, thank you.

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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include <iostream>
#include <iomanip>
using namespace std;

double getMonthTotal(); 
double getTotal(double[], int);
double findAverage(double[], int);
double findHighest(double[], int, int&);
double findLowest(double[], int, int&);

int main ()
{
	const int NUM_MONTHS = 12;
	int index = 0;
	double months[NUM_MONTHS]; 
	double yearTotal, average, highest, lowest; 

	cout << "This program ask for rain fall over a 12 month period.\n"
	<< "Once the data is entered the program will give you a total, an average\n"
	<< "and the highest and lowest months.\n";
	for (int i = 0; i < NUM_MONTHS; i++)
	{
		months[i]= getMonthTotal(); 
	}
	yearTotal = getTotal(months, NUM_MONTHS);
	average = findAverage(months, NUM_MONTHS); 
	highest = findHighest(months, NUM_MONTHS, index); 
	lowest = findLowest(months, NUM_MONTHS, index); 

	cout << "Total Rainfall for year: \t" << yearTotal << endl; 
	cout << "Average Monthly rainfall: \t" << average <<endl; 
	cout << "Least rainfall was in month: \t"<<lowest << endl;
	cout << "Most rainfall occured in month \t" <<highest <<endl;

	system("pause");
}
double getMonthTotal()
{
	double monthtotal;
	cout << "\nPlease enter rainfall total: ";
	cin >> monthtotal;
	if (monthtotal < 0)
	{ cout <<"Invalid input\n";
		getMonthTotal();
	}
	return monthtotal;
}
double getTotal(double month[], int num_months) 
{
	double total = 0;
	for (int i = 0; i < num_months; i++)
	{
		total += month[i];
	}
	return total;
}
double findAverage( double month[], int num_months) 
{
	double total = 0;
	for (int i = 0; i < num_months; i++)
	{
		total += month[i];
	}
	double average = (total / num_months);
	return average;
}
double findHighest(double month[], int num_months, int& index) 
{
	int highest = month[0];
	index = 0;
	for (int i = 0; i < num_months; i++)
	{
			if (month[i] > highest)
			{
				highest = month[i];
				index = i + 1;
			}
	}
	return index;
}
double findLowest(double month[], int num_months, int& index) 
{
	int lowest = month[0];
	index = 0;
	for (int i = 0; i < num_months; i++)
	{
		if (month[i] < lowest)
		{
			lowest = month[i];
			index = i + 1;
		}
	}
	return index;
}
Google bubble sort or insertion sort.
Topic archived. No new replies allowed.