Here is the code i currently have. As it stands, it does everything that it needs to, to return the corresponding values necessary. The one thing that I am missing, however, is a function that will return the month that corresponds to the index number associated with the temperature.
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <cstdlib>
using namespace std;
const int NUM_COLS = 2;
const int NUM_ROWS = 12;
void getData(ifstream& tempFile, double temps[][NUM_COLS]);
double averageHigh(double temps[][NUM_COLS], int NUM_ROWS);
double averageLow(double temps[][NUM_COLS], int NUM_ROWS);
double indexHighTemp(double temps[][NUM_COLS], int NUM_ROWS);
double indexLowTemp(double temps[][NUM_COLS], int NUM_ROWS);
string monthForTemp(double temps[][NUM_COLS], int NUM_ROWS);
/*
 * 
 */
int main(int argc, char** argv) 
{
    ifstream tempFile;
    double temps[NUM_ROWS][NUM_COLS] = {0.0};
    tempFile.open("Ch8_ex9Data.txt");
    if (!tempFile)
    {
        cout << "File does not exist, contact system admin" << endl;
        return 1;
    }
    getData (tempFile, temps);
    double highAverage = averageHigh(temps, NUM_ROWS);
    cout << "Average high is: " << highAverage << endl;
    double lowAverage = averageLow(temps, NUM_ROWS);
    cout << "Average low is: " << lowAverage << endl;
    int indexHiTemp = indexHighTemp(temps, NUM_ROWS);
    cout << "High temp index is: " << indexHiTemp  
         << " which is " << temps[indexHiTemp][0]
         << " degrees F" << endl;
    int indexLoTemp = indexLowTemp(temps, NUM_ROWS);
    cout << "Low temp index is: " << indexLoTemp 
         << " which is " << temps[indexLoTemp][1]
         << " degrees F" << endl;
    return 0;
}
void getData(ifstream& tempFile, double temps[][NUM_COLS])
{
    cout << fixed << showpoint << setprecision(1);
    double hiTemp, loTemp;
    tempFile >> hiTemp >> loTemp;
    int rowIndex = 0;
    while(tempFile)
    {
        temps[rowIndex][0] = hiTemp;
        temps[rowIndex][1] = loTemp;
        rowIndex++;
        tempFile >> hiTemp >> loTemp;
    }
}
double averageHigh(double temps[][NUM_COLS], int NUM_ROWS)
{
    double avgHigh = 0.0;
    double sum = 0.0;
    int i;
    for (i = 0; i < NUM_ROWS; i++)
    {
        sum += temps[i][0];
        //cout << temps[i][0] << endl;
    }
    avgHigh = sum/NUM_ROWS;
    return avgHigh;
}
double averageLow(double temps[][NUM_COLS], int NUM_ROWS)
{
    double avgLow = 0.0;
    double sum = 0.0;
    int i;
    for (i = 0; i < NUM_ROWS; i++)
    {
        sum += temps[i][1];
        //cout << temps[i][1] << endl;
    }
    avgLow = sum/NUM_ROWS;
    return avgLow;
}
double indexHighTemp(double temps[][NUM_COLS], int NUM_ROWS)
{
    cout << fixed << showpoint << setprecision(1);
    double index = 0.0;
    double maxHighTemp = 0.0;
    for (int i = 0; i < NUM_ROWS; i++)
    {
        if (temps[i][0] > maxHighTemp)
        {
            maxHighTemp = temps[i][0];
            index = i;
        }
    }
    return index;
}
double indexLowTemp(double temps[][NUM_COLS], int NUM_ROWS)
{
    cout << fixed << showpoint << setprecision(1);
    double index = 0.0;
    double maxLowTemp = 0.0;
    string month = " ";
    for (int i = 0; i < NUM_ROWS; i++)
    {
        if (temps[i][0] < maxLowTemp)
        {
            maxLowTemp = temps[i][1];
            index = i;
        }
    }
    return index, month;
}
string monthForTemp(double temps[][NUM_COLS], NUM_ROWS)
{
    string month = " ";
    switch (index)
        {
            case 1 : 
                month = "January";
                break;
            case 2 :
                month = "February";
                break;
            case 3 : 
                month = "March";
                break;
            case 4 : 
                month = "April";
                break;
            case 5 : 
                month = "May";
                break;
            case 6 : 
                month = "June";
                break;
            case 7 : 
                month = "July";
                break;
            case 8 : 
                month = "August";
                break;
            case 9 : 
                month = "September";
                break;
            case 10 : 
                month = "October";
                break;
            case 11 : 
                month = "November";
                break;
            case 12 : 
                month = "December";
                break;
        }
    return month;
}
I need to get the column and row value to be passed to the string function but I can't quite seem to get it right. Any pointers?
Thanks.
 
     
    