school/cs142/lab09/iotest.cpp
2016-04-06 20:45:34 -07:00

28 lines
511 B
C++

#include <iostream>
#include <vector>
#include <stdexcept>
using namespace std;
#include "io.h"
#include "restaurant.h"
const string usage = "usage: iotest <input json file>";
int main(int argc, char * argv[]) {
if (argc != 2) {
cerr << usage << endl;
return 1;
}
try {
vector<restaurant> v = parse_file(argv[1]);
for(auto r: v) {
cout << r << endl;
}
}
catch(runtime_error e) {
cerr << e.what() << endl;
}
return 0;
}