-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshowreport.cpp
More file actions
70 lines (57 loc) · 1.33 KB
/
showreport.cpp
File metadata and controls
70 lines (57 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <iostream>
#include <fstream>
#include <string>
#include "productiondb.h"
#include "entry.h"
#include "reporter.h"
using namespace std;
int main()
{
//Get the file name
char datafile [30];
cout << "\nPlease type in the name of the datafile.\n";
cin.get(datafile, 30, '\n');
cin.ignore(100, '\n');
//Read the data
productiondb db;
ifstream infile;
infile.open (datafile);
if (!infile)
{
cout << "\nError: File not found.\n";
}
else
{
int year;
int month;
int day;
string station;
string resource;
int amount;
while (!infile.eof())
{
infile >> year;
infile >> month;
infile >> day;
infile >> station;
infile >> resource;
infile >> amount;
if (!infile.eof())
{
entry oneEntry(year, month, day, station, resource, amount);
db.addData(oneEntry);
}
}
//Print the report
reporter reporter(db);
for (int year = 2045; year <= 2047; year++)
{
reporter.printFullReport(year);
}
for (int year = 2045; year <= 2047; year++)
{
reporter.printStationReport(year);
}
}
return 0;
}