In the main function below I am trying to pass two array parameters to a friend function which will return the month object back to the main function with the monthly updated weatherreport details. I am studying and this is my first year doing any sort of coding so please just be constructive :?:
class weatherReport
{
public:
weatherReport();//default constructor
~weatherReport();//destructor Returns all the dynamic memory used by the
//object to free store
friend istream& operator>> (istream& fin, weatherReport dailyP[]);
friend ostream& operator<< (ostream& fout, weatherReport monthlyP);
int get_dayOfMonth() const;
int get_highTemp() const;
int get_lowTemp() const;
int get_amountRain() const;
int get_amountSnow() const;
void set_dayOfMonth(int day);
void set_highTemp(int hTemp);
void set_lowTemp(int lTemp);
void set_amountRain(int rain);
void set_amountSnow(int snow);
friend weatherReport monthEnd(weatherReport daily[], weatherReport monthly);
private:
int dayOfMonth;
int highTemp;
int lowTemp;
int amountRain;
int amountSnow;
};
int main()
{
weatherReport daily[30], monthly;
int i;
ifstream in_stream;
in_stream.open("weatherData.dat");
if (in_stream.fail())
{
cout << "Input data file failed to open" << endl;
return 0;
}
in_stream >> daily;
in_stream.close();
for (int i = 0; i<MAX_SIZE-1; i++)
{
monthEnd(&daily[i], monthly);
}
return 0;