OK, I need help with getting my program to return the actual month instead of the value for the highest/lowest values. I have my program written to find the high/low numerical value but I'm at a loss for the month. I think i'm missing a part in the int main() function. Any help is appreciated!! Here's my code :
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
//*************************************************
// getTotal function adds all the entries for *
// rainfall, and returns the total *
//*************************************************
double getTotal(double rainfall[], int size)
{
double total = 0; // accumulator
// Add each months entry to the total
for (int count = 0; count < size; count++)
total += rainfall[count];
// Return the total
return total;
}
//************************************************
// getAverage function adds the entries for the *
// rainfall, then divides by the number of months*
// and returns the average value *
//************************************************
double getAverage(double rainfall[], int size)
{
double total = 0; // accumulator
double average; // hold average
for (int count = 0; count < size; count++)
total += rainfall[count];
average = total / size;
// return the average
return average;
}
//***********************************************
// getLowest function uses a for statement to *
// find the smallest value entered by user *
// and returns lowest *
//***********************************************
double getLowest(double rainfall[], int size)
{
double lowest; // hold lowest value
string lowMonth; // hold low month
// Get the array's first entry
lowest = rainfall[0];
// Compare the first entry to the rest
// of the array's entry and find the
// lowest element entered
for (int count = 1; count <= size; count++)
{
if (rainfall[count] < lowest)
lowest = rainfall[count];
}
// return the lowest value
return lowest;
}
//***********************************************
// getHighest function uses a for statement to *
// find the highest value entered by user *
// and returns highest *
//***********************************************
double getHighest(double rainfall[], int size)
{
double highest; // hold highest value
// Get the array's first entry
highest = rainfall[0];
// Compare the first entry to the rest
// of the array's entries and find the
// highest element entered
for (int count = 1; count < size; count++)
{
if (rainfall[count] > highest)
highest = rainfall[count];
}
// return highest
return highest;
}