-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
42 lines (37 loc) · 938 Bytes
/
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
#include <iostream>
#include <algorithm>
#include <vector>
#include <random>
#include <chrono>
#include <thread>
using namespace std;
int main(void) {
int n = 0;
cout << "==== 🎲 SortMe 🎲 ====" << endl;
cout << "How many?? " << flush;
cin >> n;
cout << "= Input your objects =" << endl;
std::vector<string> input;
for (int i = 0; i < n ; ++i) {
cout << i + 1 << ": " << flush;
string object;
cin >> object;
input.push_back(object);
}
cout << "====== Sorting =======" << endl;
int counter = 22;
string symbol = "#";
int duration = 3000/22;
while (counter > 0) {
std::this_thread::sleep_for(std::chrono::milliseconds(duration));
cout << symbol << flush;
--counter;
}
cout << endl;
cout << "======================" << endl;
std::random_shuffle(input.begin(), input.end());
for (int i = 0; i < n; ++i) {
cout << i + 1 << ": " << input[i] << endl;
}
return 0;
}