View Single Post
Old 10-25-2005, 03:46 AM   #2 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,726
redhead is on a distinguished road
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.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote