-
Notifications
You must be signed in to change notification settings - Fork 320
Expand file tree
/
Copy paththemes.cpp
More file actions
43 lines (38 loc) · 1.14 KB
/
Copy paththemes.cpp
File metadata and controls
43 lines (38 loc) · 1.14 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
#include "themes.hpp"
#include "menu.hpp"
std::string Themes::themedOutput(ull value) {
switch (themeCode) {
case 1:
return std::to_string(value);
case 2:
return elements[log2(value) - 1];
case 3:
return std::to_string(fibonacci_numbers[log2(value) - 1]);
case 4:
return programming_languages[log2(value) - 1];
default:
return "ERR";
}
}
void Themes::chooseTheme() {
bool err = false;
while ((themeCode > themeCount || themeCode < 1)) {
clearScreen();
drawAscii();
if (err) {
std::cout << red
<< " Invalid input. Theme number should range from 1 to "
<< themeCount << "." << def;
endl(2);
}
std::cout << bold_on << " 1. Standard: 2, 4, 8, ..." << std::endl
<< " 2. Elements: H, He, Li, ..." << std::endl
<< " 3. Fibonacci Numbers: 1, 2, 3, ..." << std::endl
<< " 4. Programming Languages: C, C++, PHP, ..." << std::endl
<< " Enter theme number: " << bold_off;
std::cin >> themeCode;
std::cin.clear();
std::cin.ignore(std::numeric_limits<std::int32_t>::max(), '\n');
err = true;
}
}