-
Notifications
You must be signed in to change notification settings - Fork 0
/
driver.cpp
107 lines (91 loc) · 1.84 KB
/
driver.cpp
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#include <iostream>
#include <fstream>
#include <string>
#include "archive.h"
using namespace std;
void menu();
string getBrother();
string getClass();
int main(int args, char* argsv[]){
// Checks and reads file
ifstream in(argsv[1]);
if(!in){
in.open(("registry.csv"));
if(!in){
cout << "Usage: psi_lineage.x csv_file" << endl;
return 0;
}
}
// Creates archive for Psi brothers
archive Psi;
Psi.readFile(in);
cout << endl << "\tPsi Records" << endl;
string brother;
int pos = 99;
int aPos = 120;
char select;
do{
menu();
cin >> select;
switch(tolower(select)){
case 's':
brother = getBrother();
Psi.printBanner();
Psi.printInfo(Psi.searchBrother(brother));
break;
case 't':
Psi.printFamily(
Psi.searchBrother(getBrother()));
break;
case 'r':
Psi.printATree(
Psi.searchBrother(getBrother()), aPos);
break;
case 'l':
Psi.printList();
break;
case 'o':
Psi.printLine(
Psi.searchBrother(getBrother()));
break;
case 'c':
Psi.printClass(getClass());
break;
case 'q':
break;
default:
cout << "Not a valid entry" << endl;
break;
}
cout << endl;
} while(tolower(select) != 'q');
cout << endl << "Goodbye." << endl;
return 0;
}
string getBrother(){
cin.ignore();
string brother;
cout << "Enter a brother: ";
getline(cin, brother);
cout << endl;
return brother;
}
string getClass(){
cin.ignore();
string c;
cout << "Enter class: ";
getline(cin, c);
cout << endl;
return c;
}
void menu(){
cout << "---------------------" << endl
<< "S\tSearch brother" << endl
<< "C\tPrint class/family" << endl
<< "T\tPrint tree" << endl
<< "R\tPrint normalized tree" << endl
<< "O\tPrint line of brother" << endl
<< "L\tList Brothers" << endl
<< "Q\tQuit" << endl << endl
<< "> ";
}