-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTroBeta.cpp
More file actions
54 lines (45 loc) · 1.78 KB
/
TroBeta.cpp
File metadata and controls
54 lines (45 loc) · 1.78 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
#include "Users.h"
#include "UserLibraries.h"
#include "History.h"
#include "GeneralFunctions.h"
using namespace std;
int main(int argc, char* argv[]){
User* User1 = NULL;
string op;
bool login = false;
UserFile myUsers("users.csv");
BetFile myBets;
Hierarchy myHierarchy("hierarchy.dat");
HistoryAdapter::setFile("audit.log");
if (argc == 2 && strcmp(argv[1], "-R") == 0){ // Registration Mode
cout << "============================= REGISTRATION ===========================" << endl;
login = Registration(myUsers, User1);
}
else if(argc == 1){ // Login Mode
while(!login){
cout << "=============================== LOGIN ================================" << endl;
login = Login(myUsers, User1);
}
}
else { // Invalid Command Line Arguments
cout << "================================ ERROR ===============================" << endl;
cout << "--- Invalid Command Line Arguments ---" << endl << endl;
}
myUsers.close_UserFile();
if (login){ // Check Login
// If you are here, the login was successful
while(op != "X"){
cout << "======================================================================" << endl;
NodeNavigationScreen(myHierarchy, User1);
cout << endl << "Your Choice: ";
getline(cin, op);
cout << endl;
User1->operation(op, myHierarchy, myUsers, myBets); // Execute the given operation
}
}
// if you are here, operation X(Exit) has been given
cout << "Exiting the system..." << endl;
delete User1;
cout << "======================================================================" << endl;
return 0;
}