I have put together a program that displays rainfall in each of the twelve months but I am having a hard time sorting the months from most rainfall to least rainfall. Any help is appreciated. Thank you.
cout << "The total rainfall of the year was " << RAINTOTAL << " inches. "<< endl; // Displays total rainfall
cout << endl;
cout << "The average rainfall of the year was " << RAINAVERAGE << " inches. " << endl; // Displays average rainfall
cout << endl;
cout << Low_Month << " had the least rainfall of the year with " << Low_Point << " inches. " << endl; // Displays least rainfall of the year
cout << endl;
cout << High_Month << " had the most rainfall of the year with " << High_Point << " inches. " << endl; // Displays most rainfall of the year
cout << endl;
return 0;
}
double getTotal(double RainAmt[], int size)
{
double Total = 0;
for (int count = 0; count < size; count++)
{
Total += RainAmt[count];
}
return Total;
}
double getAverage(double RainAmt[], int size)
{
double Total = 0;
double Average;
for (int count = 0; count < size; count++)
{
Total += RainAmt[count];
}
Average = Total / size;
return Average;
}
double getLowest(double RainAmt[], int size)
{
double Low_Point = RainAmt[0];
int Low_Count = 0;
Thank you, I implemented the changes. Advice on how to get it to display the months in descending order, most rainfall to the least? I am messing around with something but not getting the results I am looking for.