-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
178 lines (140 loc) · 4.7 KB
/
main.cpp
File metadata and controls
178 lines (140 loc) · 4.7 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
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
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>
using namespace std;
int main()
{
ifstream survey("survey.csv"); //the csv is passed into survey object
vector<string> description(12835);
vector<string> industry(12835);
vector<string> level(12835);
vector<string> sizee(12835);
vector<string> code(12835);
vector<string> value(12835);
//variable declaring
int vecSize = 12835;
int counter = 0;
int userChoice = 0;
int i;
//storing the values of each category
while(survey.good()){
for(i=0 ; i <vecSize; i++){
getline(survey,description[i],',');
getline(survey,industry[i],',');
getline(survey,level[i],',');
getline(survey,sizee[i],',');
getline(survey,code[i],',');
getline(survey,value[i],'\n');
}
}
//Give choice to users
cout << " Enter your choice of search category :\n";
cout << " Press 1 to search by Industry\n";
cout << " Press 2 to search by level \n";
cout << " Press 3 to search by size \n";
cout << " Press 4 to search by code \n";
cout << " Press 5 to search by value \n";
cin >> userChoice;
if(userChoice == 1)
{
string match;
cout<< "Enter the Industry detail:";
cin.ignore();
getline(cin, match);
for( size_t j = 0 ; j < industry.size(); ++j )
{
size_t found = industry[j].find(match);
if (found != string::npos)
{
cout<< description[j] << " , " ;
cout<< industry[j] << " , " ;
cout<< level[j] << " , " ;
cout<< sizee[j] << " , " ;
cout<< code[j] << " , " ;
cout<< value[j] << endl;
}
}
}
else if(userChoice == 2)
{
string match;
cout<< "Enter the Level:";
cin.ignore();
getline(cin, match);
for( size_t j = 0 ; j < level.size(); ++j )
{
size_t found = level[j].find(match);
if (found != string::npos)
{
cout<< description[j] << " , " ;
cout<< industry[j] << " , " ;
cout<< level[j] << " , " ;
cout<< sizee[j] << " , " ;
cout<< code[j] << " , " ;
cout<< value[j] << endl;
}
}
}
else if(userChoice == 3)
{
string match;
cout<< "Enter the Size:";
cin.ignore();
getline(cin, match);
for( size_t j = 0 ; j < sizee.size(); ++j )
{
size_t found = sizee[j].find(match);
if (found != string::npos)
{
cout<< description[j] << " , " ;
cout<< industry[j] << " , " ;
cout<< level[j] << " , " ;
cout<< sizee[j] << " , " ;
cout<< code[j] << " , " ;
cout<< value[j] << endl;
}
}
}
else if(userChoice == 4)
{
string match;
cout<< "Enter the Line Code:";
cin.ignore();
getline(cin, match);
for( size_t j = 0 ; j < code.size(); ++j )
{
size_t found = code[j].find(match);
if (found != string::npos)
{
cout<< description[j] << " , " ;
cout<< industry[j] << " , " ;
cout<< level[j] << " , " ;
cout<< sizee[j] << " , " ;
cout<< code[j] << " , " ;
cout<< value[j] << endl;
}
}
}
else if(userChoice == 5)
{
string match;
cout<< "Enter the Value:";
cin.ignore();
getline(cin, match);
for( size_t j = 0 ; j < value.size(); ++j )
{
size_t found = value[j].find(match);
if (found != string::npos)
{
cout<< description[j] << " , " ;
cout<< industry[j] << " , " ;
cout<< level[j] << " , " ;
cout<< sizee[j] << " , " ;
cout<< code[j] << " , " ;
cout<< value[j] << endl;
}
}
}
}