-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
27 lines (25 loc) · 907 Bytes
/
Copy pathmain.cpp
File metadata and controls
27 lines (25 loc) · 907 Bytes
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
#include "Person.cpp"
#include <random>
#include <algorithm>
using namespace std;
int main() {
vector<Person> people;
string fnLine;
string lnLine;
ifstream fn ("fn.txt"); // use your own files if you wish
ifstream ln ("ln.txt"); // use your own files if you wish
if (fn.is_open() && ln.is_open()) {
while (getline (fn, fnLine) && getline(ln, lnLine)) {
Person p = extractPerson(fnLine, lnLine);
people.push_back(p);
}
fn.close(), ln.close();
vector<Person> randomPeople = generateRandomPeople(people);
printPeople(randomPeople);
cout << "[RANDOM PEOPLE LIST PRINTED]" << endl; // TODO: Add selection menu for list, extracting one person, etc.
cout << "Random Person: " << getRandomPerson(randomPeople) << endl;
} else {
cout << "File not found!" << endl;
}
return 0;
}