Assignment - read an input file that has month, highest temp for month and lowest temp for month.
I have to use a function called GetData to fill the array.
I define the array as 12 rows and 3 columns. Please could someone look at the code I have and let me know if I'm creating the prototype correctly and the function call. I'm getting that ol' undeclared identifier error on GetData(m_t[]) I have only coded the GetData function so far. To my understanding the array m_t was identified in the function prototype. Do I have to do a priming read first?
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
void GetData(ifstream& in, double m_t[]);
void AverHigh(double m_t[],double& sum, double& aver_h)
void AverLow (double m_t[],double& sum, double& aver_l);
void HighestTemp(double m_t[], double& high);
void LowestTemp(double m_t[], double& low);
void PrintData (ofstream& out, double m_t[],double& aver_h, double& aver_l, double& high, double& low);
int main ()
{
int r = 12;
int c = 3;
ifstream in;
ofstream out;
in.open("temp.txt");
if (!in)
{
cout << "Cannot open input file." << endl;
return 1;
}
out.open("outdata");
while (in)
{
GetData(in, m_t[]);
AverHigh(m_t[], sum, aver_h);
AverLow (m_t[], sum, aver_l);
HighestTemp(m_t[], high);
LowestTemp(m_t[], low);
PrintData (out, m_t[], aver_h, aver_l, high, low);
}
return 0;
}
void GetData(ifstream& in, m_t[])
{
double rcount = 12;
double ccount = 3;
int i;
int j;
in >> r >> c;
for (i=0, i < rcount, i++)
for (j=0, j < ccount, j++)
{ in >> m_t(i,j);