everything works except I need it to give me the max and min month (i.e. 1,2,3..12) instead of the number entered into the array.
#include <iostream>
using namespace std;
int main()
{
const int SIZE = 12;
double months[SIZE];
int count;
double sum = 0;
double totalRainfall;
double averageMonthlyRainfall;
double min, max;
for (count=0; count<SIZE; count ++)
{
cout << "What is the average rainfall for month"
<< (count+1) << ": ";
cin >> months[count];
}
for (count=0; count<SIZE; count++)
{
sum += months[count];
}
totalRainfall= sum;
cout << "total rainfall all year was " << totalRainfall << endl;
averageMonthlyRainfall=sum/12;
cout << "average rainfall per month was " << averageMonthlyRainfall << endl;
max = months[0];
for (count=0; count<SIZE; count++)
{
if (months[count] > max)
max=months[count];
}
cout << "the max rain fall was " << max << endl;
min = months[0];
for ( count=0; count<SIZE; count++)
{
if (months[count] < min)
min=months[count];
}
cout << "the min rain fall was " << min << endl;
return 0;
}