Use the Matrix class to hold the weather data.
Do not include the year - only the monthly averages.
Use command line arguments: name of file, starting year
I'm a bit wet behind the ears about command line arguments, even about why would one want to store data in argc & argv, its purpose beyond that, and it's usefulness. Nevertheless, I must use it to open a file and hold the starting year for the data. Being inexperienced with command line arguments, I not sure how to even access that info and store it into the matrix class.
Can anyone explain to me the things I don't understand. Just incase my code is needed this is how far I got before these questions plagued my mind.
class matrix
{
int numCol;
int numRow;
double ** Matrix;
public:
matrix();
~matrix();
double avgRow(int)const; //Average temperature for a given year
double hghstRow(int)const; //Highest temperature for a given year
double avgCol(int)const; //Average temperature for a given month
double hghstCol(int)const; //Highest temperature for a given month
double getTemp(int, int)const;
staticconstint rowMaxNumOf = 2;
staticconstint colMaxNumOf = 2;
};
argc and argv are simply a way for passing information from the command line to your program.
argc contains the number of arguments. argv is an array of pointers to C-strings containing those arguments. argv[0] is always the filename of your program. argv[1] (if present) contains the first actual argument.
1 2 3 4 5 6 7 8 9 10 11 12
int main (int argc, constchar *argv[])
{ constchar * prog = argv[0];
constchar * filename;
int year;
if (argc < 3)
{ cout << "filename and year required" << endl;
return 1;
}
filename = argv[1];
year = atoi (argv[2]);
...