-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.cpp
46 lines (33 loc) · 1.02 KB
/
Main.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
#include <iostream>
#include <memory>
#include "Random.h"
#include "SelectionAlgorithm.h"
const unsigned int amount = 10;
int main() {
Random<> random;
std::vector<int> numbers;
// Sets the random order
for (int i = 1; i <= amount; i++) { numbers.emplace_back(i); }
for (int i = 0; i < numbers.size() - 1; i++) {
int j = random.getInt(1, numbers.size() - 1);
std::swap(numbers[i], numbers[j]);
}
// Asks user for algorithm type
int type;
std::cout << "What Algorithm would you like to use?\n"
<< "1. Sorting Algorithm\n"
<< "2. Exit\n"
<< ">> ";
std::cin >> type;
// Gives the pre sort
for (auto& amt : numbers) { std::cout << "Pre Sort: " << amt << '\n'; }
// Gives the algorithm the correct information to organize the numbers
if (type == 1) {
SelectionAlgorithm selectiveAlgorithm(numbers);
selectiveAlgorithm.sort();
// Gives the sorted order
for (auto& amt : selectiveAlgorithm.getNumbers()) { std::cout << "Post Sort: " << amt << '\n'; }
}
else if (type == 2) { return 0; }
system("pause");
}