30 lines
610 B
C++
30 lines
610 B
C++
#include <iostream>
|
|
#include <string>
|
|
#include <vector>
|
|
#include <stdexcept>
|
|
|
|
using namespace std;
|
|
|
|
#include "person.h"
|
|
#include "util.h"
|
|
|
|
const string usage = "usage: app <input file> <output file>";
|
|
|
|
int main(int argc, char * argv []) {
|
|
if(argc != 3) {
|
|
cerr << usage << endl;
|
|
return 1;
|
|
}
|
|
string input_filename(argv[1]);
|
|
string output_filename(argv[2]);
|
|
try {
|
|
vector<person> people = parse_file(input_filename);
|
|
save_file(output_filename, people);
|
|
}
|
|
catch(runtime_error e) {
|
|
cerr << e.what() << endl;
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|