Hey guys,
This is my second post and is URGENT!!!! My final assignment is due tonite for class and I have no idea how to write this program right!
I am supposed to write a program that uses a two-dimensional array to store the highest and lowest temperatures (in farenheit) for each month of the year. The program is supposed to output the average high, average low and the highest and lowest temperatures of the year. I need it to print out as a line(for the respones that have more than one number) and just the number when I ask for only one.
This is what I have so far...some of my program is not filled in because I am not sure what to put in it!! LOL IThe "cout"'s are all the responses that must be output to the screen...PLEASE HELP!!!!
It is due by midnight tonight and it is 6:30 now...
Thanks,
Shel
================================================== =======
#include <iostream>
#include <iomanip>
using namespace std;
const int cMAX_ROWS = 2;
const int cMAX_COLS = 12;
void getData (int table[][cMAX_COLS]);
void averageHigh (const int table[][cMAX_COLS], int avgHigh);
void averageLow (const int table[][cMAX_COLS], int avgLow);
void indexHightemp (const int table[][cMAX_COLS], int indexHigh);
void indexLowtemp (const int table[][cMAX_COLS], int indexLow);
int main ()
{
int table [cMAX_ROWS][cMAX_COLS];
int avgHigh [cMAX_ROWS] = { 0 };
int avgLow;
int indexHigh;
int indexLow;
getData (table);
averageHigh (table, avgHigh);
averageLow (table, avgLow);
indexHightemp (table, indexHigh);
indexLowtemp (table, indexLow);
cout << "Enter high temperature for each month (space between): \n";
cin >> highTemps;
cout << "\n";
cout << "Enter low temperature for each month (space between): \n";
cin >> lowTemps;
cout << "\n";
cout << "Press q and then Enter to quit-->"; //
char dummy;
cin >> dummy; //Wait for input
return;
} // main
//========================getData=================== ========
// This function will fill the array.
// =================================
void getData (int table[][cMAX_COLS])
{
for (int row = 0; row < cMAX_ROWS; row++)
for (int col = 0; col < cMAX_COLS; col++)
cin >> table[row][column]);
return;
} // getData
//=====================averageHigh ==========================
// This function will calculate the average high temp for month.
// =================================
void averageHigh (const int table[][cMAX_COLS], int avgHigh)
{
for (int row = 0; row < 2; row++)
for (int column = 0; column < 12; column++)
}
cout << "Average high temperature: ";
cin >> avgHigh;
cout << "\n";
return;
// avgHigh
//==================averageLow====================== =======
// This function calculates the average low temp for month.
// =============================
void averageLow (const int table[][cMAX_COLS], int avgLow);
{
for (int row = 0; row < 2; row++)
for (int column = 0; column < 12; column++)
}
cout << "Average low temperature: ";
cin >> avgLow;
cout << "\n";
return;
// averageLow
//=================== indexhigh=============================
// This function calculates the index high temp for the month.
// ================================
void indexHightemp (const int table[][cMAX_COLS], int indexHigh)
{
some for loop goes here
}
cout << "Highest temperature: ";
cin >> indexHigh;
cout << "\n";
return;
// indexHigh
//==================== indexLow ============================
// This function calculates the index low temp for the month.
// ===================================
void indexLowtemp (const int table[][cMAX_COLS], int indexLow)
{
some for loop goes here
}
cout << "Lowest temperature: ";
cin >> indexLow;
cout << "\n";
return;
// indexLow