-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspotGraph (1).cpp
More file actions
97 lines (90 loc) · 3.16 KB
/
spotGraph (1).cpp
File metadata and controls
97 lines (90 loc) · 3.16 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
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
#include <fstream>
#include <sstream>
#include <chrono>
#include <queue>
#include <limits>
#include "AdjacencyList.h"
// Adjacency list implementation
void printMenu();
constexpr wchar_t * const texts[] = { // Need this for special characters
L"Ñá", //Spanish
L"forêt intérêt", //French
L"Gesäß", //German
L"取消波蘇日奇諾", //Chinese
L"日本人のビット", //Japanese
L"немного русский", //Russian
L"ένα κομμάτι της ελληνικής", // Greek
L"ਯੂਨਾਨੀ ਦੀ ਇੱਕ ਬਿੱਟ", // Punjabi
L"کمی از ایران ", // Persian
L"కానీ ఈ ఏమి నరకం ఉంది?", //Telugu
L"Но какво, по дяволите, е това?" //Bulgarian
};
int main()
{
string line;
bool programRunning = true;
int option = -1;
int numOfFiles = 18;
AdjacencyList list;
for(int i = 0;i < numOfFiles;i++) // File input for csv
{
ifstream inFile("CSV/file" + to_string(i) + ".csv");
string tokens[3];
if(inFile.is_open())
{
getline(inFile,line);
int i = 0;
// Break each line into the form of from, to, weight tokens to enter into graph
while(getline(inFile,line))
{
istringstream stream(line);
for(int j = 0; j < 3; j++)
getline(stream,tokens[j],',');
string from = tokens[0];
string to = tokens[1];
double weight = stod(tokens[2]);
list.insert(from,to,weight);
}
}
}
//list.printTest("POPULAR");
cout << right << setw(35) << "WELCOME TO OUR PROJECT" << endl << endl;
// Menu implementation for user
while(programRunning)
{
string name;
printMenu();
cin >> option;
// Option to search related artist, search most popular related artists, search most niche related artists.
switch(option)
{
case 0:
programRunning = false;
cout << "THANK YOU FOR USING OUR PROGRAM" << endl;
break;
case 1:
list.search();
break;
case 2:
list.mostPop();
break;
case 3:
list.mostNiche();
break;
default:
cout << left << setw(20) << "INVALID INPUT, TRY AGAIN" << endl;
break;
}
//cin.ignore(numeric_limits<streamsize>::max(), '\n');
}
return 0;
}
void printMenu()
{
cout << endl << right << setw(25) << "RELATED ARTIST GRAPH" << endl << endl;
cout << left << setw(20) << "SELECT AN OPTION:" << endl << endl;
cout << left << setw(20) << "1: SEARCH AN ARTIST" << endl;
cout << left << setw(20) << "2: TOP TWENTY MOST POPULAR RELATED ARTISTS" << endl;
cout << left << setw(20) << "3: TOP TWENTY MOST NICHE RELATED ARTISTS" << endl;
cout << left << setw(20) << "0: EXIT" << endl;
}