-
Notifications
You must be signed in to change notification settings - Fork 0
/
FinalProject.cpp
executable file
·191 lines (115 loc) · 2.88 KB
/
FinalProject.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#include <iostream>
#include <fstream>
#include <string> // std::string, std::stoi
#include "priorityQueueLL.h"
#include "main.h"
#include "priorityQ.h"
#include "minHeap.h"
#include <iostream>
#include <vector>
#include <sstream> //string stream
using namespace std;
int printMenu(int quitNumber)
{
int input = 0;
bool pass = false;
//cout << "======Main Menu======" << endl;
cout<<endl;
cout << "----Linked List----"<<endl;
cout << "1. Read and Build Linked List" << endl;
cout << "2. Print Linked List" << endl;
cout << "3. Dequeue Linked List " << endl;
cout << "4. Delete Linked List"<<endl;
cout<<endl;
cout << "----Priority Queue----"<<endl;
cout << "5. Build Priority Queue"<<endl;
cout << "6. Print and Pop"<<endl;
cout << "7. Dequeue Patient"<<endl;
cout<<endl;
cout << "----Heap----"<<endl;
cout << "8. Build Heap"<<endl;
cout << "9. Pop & sort"<<endl;
cout << "10. Pop Single"<< endl;
cout << "11. Quit" << endl;
cout << "**********************************"<<endl;
while(pass == false)
{
cout<<"Input: ";
cin>>input;
if(input>quitNumber || input<1)
{
break;
}
else if(input>0 && input<=quitNumber)
pass = true;
else
pass = false;
}
return input;
}
int main()
{
priorityLL LL; //LL class comms with build class
PriorityQ qLib;
MinHeap h(DATA_SIZE);
string file = "patientData2270.csv"; ///command line after implementation
//string file = "data.csv";
int i =0;
string deqCount;
int num = 0;
int quitNum = 11;
while(i != quitNum)
{
i =printMenu(quitNum);
switch(i)
{
case 1:
// build.readAndBuildFile(file); //read build and sort
// build.bubbleSort(DATA_SIZE);
LL.buildLL(file); //builds linked list from build class
break;
case 2:
LL.printLL();
break;
case 3:
cout << "How many patients to dequeue? " << endl;
cin.ignore(256,'\n');
getline(cin,deqCount);
num = stoi(deqCount);
LL.dequeuePatient(num);
break;
case 4:
LL.deleteALL();
break;
case 5:
qLib.readAndBuildQueue(file);
break;
case 6:
qLib.printPop();
break;
case 7:
qLib.dequeuePatient();
break;
case 8:
h.readAndBuildStruct(file);
break;
case 9:
h.sortStruct();
break;
case 10:
h.pop();
break;
case 11:
cout << "Goodbye!" << endl;
break;
default:cout<<endl<<"derp"<<endl;
i = 4;
break;
}
}
// MinHeap heap(DATA_SIZE);
// heap.print();
// heap.readAndBuildStruct(file);
// heap.sortStruct();
return 0;
}