Code:
115: out << setw(10) << "Day"
<< set(10) << t.day << "|" << setw(10) << "Low"
<< set(10) << t.low << "|" << setw(10) << "High"
<< set(10) << t.high << "|" << setw(10) << "Normal"
<< set(10) << endl;
Do you see the error now ??
2. Open the file for input. test for failure, and repeat until a valid filename is entered.
It's not doing that, returning with
exit(1); isn't telling it to ask the user again.
Code:
while(fin.fail())
{
cout << "Enter the name of the data file: ";
cin >> filename;
fin.open(filename);
if(fin.fail())
cout << "Error opening file: " << filename << endl;
}
would be one way to achieve that.
- A line that displays the year and month of the data contained in the report.
- A header line that labels each of the columns.
- A record for each day of data read in. Each record should contain:
- Day (as a number)
- Low (F)
- High (F)
- Average (F) (which is defined as (Low + High) / 2.0).
- Difference from normal (F) This is defined as the actual average temp minus the normal temp for the day. Use the actual number
- the bottom outputs the average temperature for the month in both Fahrenheit and Celsius.
This is not happening, you call generate_report() but itjust copies the input file directly to the output file.
Read your code closely while keeping those restrictions in mind.