-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFinalProject.cpp
169 lines (128 loc) · 3.92 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
// Connor Humiston
// Godley 310
// Data Structures
// Final Project: A Nation Divided
// This file contains main and the program
#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
#include "CityGraph.hpp"
using namespace std;
int main(int argc, char* argv[])
{
//instantiate the Graph and insert all the movies from the filename that was passed in the command line
CityGraph graph;
string adjacencyMatrixFileName = argv[1];
graph.insertCities(adjacencyMatrixFileName);
//string infectionFileName = argv[2];
bool isRunning = true;
while(isRunning)
{
//Program start
//Printing the menu:
cout << "\n";
cout << "======Main Menu======" << endl;
cout << "1. Print Vertices" << endl;
cout << "2. Vertex Adjacent" << endl;
cout << "3. Quit" << endl;
/*
cout << "2. Find Districts" << endl;
cout << "3. Find Shortest Path" << endl;
cout << "4. Find Shortest Weighted Path" << endl;
cout << "5. Zombie Infection!" << endl;
cout << "6. Quit" << endl;
*/
int numIn;
cin >> numIn;
switch(numIn)
{
case 1: //Print the vertices
{
cout << "Print Vertices" << endl;
cout << "\n";
graph.printVertices();
break;
}
case 2: //Vertex Adjacent
{
// This option takes two vertices as user inputs and displays
// True is the vertices are adjacent &
// False if they are not adjacent
cout << "Vertex Adjacent" << endl;
cout << "\n";
string city1 = "";
string city2 = "";
cin.ignore();
cout << "Enter a starting city: " << endl;
getline(cin, city1);
cout << "Enter an ending city: " << endl;
getline(cin, city2);
if(graph.isAdjacent(city1, city2) == 1)
cout << "\nTrue" << endl;
else
cout << "\nFalse" << endl;
break;
}
case 3: //Quit
{
cout << "Goodbye!\n" << endl;
isRunning = false;
graph.~CityGraph();
exit(0);
break;
}
//FOR PART II
/*
case 2: //Find the districts
{
cout << "Find Districts" << endl;
cout << "\n";
cout << "\n";
graph.printGraph();
break;
}
case 3: //Find the shortest path
{
cout << "Find Shortest Path" << endl;
cout << "\n";
break;
}
case 4: //Find the shortest weighted path
{
cout << "Find Shortest Weighted Path" << endl;
cout << "\n";
string city1 = "";
string city2 = "";
cin.ignore();
cout << cout << "Enter a starting city: " << endl;
getline(cin, city1);
cout << "Enter an ending city: " << endl;
getline(cin, city2);
cout << "\n";
graph.printGraph();
break;
}
case 5: //Zombie Infection!
{
cout << "Zombie Infection!" << endl;
cout << "\n";
break;
}
case 6: //Quit
{
cout << "Goodbye!\n" << endl;
isRunning = false;
graph.~CityGraph();
exit(0);
break;
}
*/
default:
{
cout << "Sorry that wasn't an option. Please reload the program and try again." << endl;
isRunning = false;
}
}
}
}