-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
96 lines (86 loc) · 2.46 KB
/
Copy pathmain.cpp
File metadata and controls
96 lines (86 loc) · 2.46 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
#include <iostream>
#include <chrono>
#include <thread>
std::string getOsName() {
#ifdef _WIN32
return "Windows 32-bit";
#elif _WIN64
return "Windows 64-bit";
#elif __APPLE__ || __MACH__
return "Mac OSX";
#elif __linux__
return "Linux";
#elif __FreeBSD__
return "FreeBSD";
#elif __unix || __unix__
return "Unix";
#else
return "Other";
#endif
}
int main() {
const char *clear_cmd{"clear"};
if ("Windows 32-bit" == getOsName() || "Windows 64-bit" == getOsName())
clear_cmd = "cls";
system(clear_cmd);
std::cout << "Assurez vous de mettre le terminal en fullscreen! [ENTREE] pour continuer...";
std::cin.get();
system(clear_cmd);
size_t millis{100};
size_t max_spaces{10};
std::string base_str{};
while (true) {
std::cout << "Combiens de milliseconds (recommendation=100): ";
if (std::cin >> millis) {
std::cout << std::endl;
break;
} else {
std::cin.clear();
std::cin.ignore();
std::cout << "no." << std::endl;
}
}
system(clear_cmd);
while (true) {
std::cout << "Combiens d'espaces max (recommendation=20): ";
if (std::cin >> max_spaces) {
std::cout << std::endl;
break;
} else {
std::cin.clear();
std::cin.ignore();
std::cout << "no." << std::endl;
}
}
while (true) {
system(clear_cmd);
std::cout << "Entrez votre nom en MAJ separe d'un espace: ";
if (std::cin >> base_str) {
std::cout << std::endl;
break;
} else {
std::cin.clear();
std::cin.ignore();
std::cout << "no." << std::endl;
}
}
system(clear_cmd);
while (true) {
for (size_t i{0}; i < max_spaces; i++) {
std::string show_str{};
for (char ii: base_str) {
show_str += ii + std::string(i, ' ');
}
std::cout << "\t" << show_str << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds((int) millis / 2));
}
for (size_t i{max_spaces}; i > 0; i--) {
std::string show_str{};
for (char ii: base_str) {
show_str += ii + std::string(i, ' ');
}
std::cout << "\t" << show_str << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds((int) millis / 2));
}
}
}