I am having a huge problem. I've been assigned an assignment where I am supposed to ...
1. Declare the file objects for the two input files (location 1 (IL) & location 2 (TN)) and
two output files.
2. Open the files, checking the input files for errors. If an open error occurs, issue an
error message then return with error code 1.
3. Generate and output the report major and column headings.
4. Enter main logic loop, read a record from location #1 – exit the loop at End of File.
5. Read a record from location #2’s file.
6. Check that the file dates are equal, if not exit error return 2.
7. If the date is < 20130101, continue loop.
8. If the temperature data is < -50, do not process this data just continue the loop.
9. Output the detail file temp.txt record: date, temperature location 1, temperature
location 2, and temperature differential (location 2-location 1).
10. Output the detail report: date, temperature location 1, temperature location 2, and
temperature differential (location 2-location 1). Use manipulators to properly format
output. Use the setfill(‘0’) manipulator to zero fill the date output.
11. To compute the average temperature for each location, sum the temperature for both
locations using separate variables, i.e., sum1, sum2.
12. Sum the differential: sumdif+= (temp2 - temp1);
13. Count the number of records read.
14. To compute the min and max temperature values by location: declare 4 variables
min1, max1, min2, and max2 for locations 1 and 2 respectively.
15. If the count (of records read) is 1, set the maxi1 and min1 to temp 1 and maxi2 and
min2 to temp2.
16. Determine min and max values for each location, by comparing temp1 to min1 and
max1. Replace the min1 value with temp1 if temp1< min1, replace the max1 value
with temp1 if temp1>max1. Do the same process with temp2, min2, and max2.
17. Determine temperature distribution: >80, >50<=80, >30<=50, or <=30.
18. At the end of file, output the final summary data record.
19. Summary Report:
a) Output the min, max, and average temperature for each location.
b) Output the average temperature differential.
c) Output the distribution report (see report sample for specific format).
20. Close the files and return 0.
And the only thing I can come up with is this:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
// Open the two files.
ifstream inputFile;
inputFile.open("ILROCKFO.txt");
inputFile.open("TNNASHVI.txt");
system("PAUSE");
return 0;
}
I can't figure out how to write the loops or move on from this point at all.
Please help me:(
This class is not in my major, just a distribution requirement. I've been able to figure out all my other assignments until now.