-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
47 lines (40 loc) · 1.11 KB
/
main.cpp
File metadata and controls
47 lines (40 loc) · 1.11 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
// Author: Kristi Daigh
// Project: MLEM2 Rule Induction
// Date: 11/20/2019
#include "executive.hpp"
#include <iostream>
#include <stdexcept>
#include <string>
#include <limits>
using namespace std;
/* Utility function */
string getFile(string type);
int main(int argc, char* argv[]){
bool validFile = false;
string inFile, outFile;
Executive exec;
// Request input file from user
while(!validFile){
inFile = getFile("input");
validFile = exec.parseInFile(inFile);
}
// Run rule induction algorithm on dataset and print to file
validFile = false;
while(!validFile){
outFile = getFile("output");
validFile = exec.generateOutFile(outFile);
}
return 0;
}
string getFile(string type){
cout << "Please provide an " << type << " file (i.e. " << type << "_test.txt):" << endl;
string file;
cin >> file;
while(cin.fail()){
cin.clear();
cin.ignore(numeric_limits<streamsize>::max(),'\n');
cout << "\nPlease provide an " << type << " file (i.e. " << type << "_test.txt):" << endl;
cin >> file;
}
return file;
}