-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
102 lines (82 loc) · 3.46 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
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
97
98
99
100
101
102
//#include "inc/Elevator/Elevator.h"
//#include "inc/Input/input.h"
#include <iostream>
#include <limits> // for std::numeric_limits
#include "src/Program/program.cpp"
int main(){
try {
program_main(); // Call the main program function
return 0; // Return 0 to indicate successful execution
} catch (const std::exception& e) {
std::cerr << "Exception caught: " << e.what() << std::endl;
return 1; // Return 1 to indicate an error
} catch (...) {
std::cerr << "Unknown exception caught" << std::endl;
return 1; // Return 1 to indicate an error
}
/* INP::input userInput;
int count = 0;
int size = 0;
userInput.menu();
while (true) {
std::string userPressedButton{};
int pressed_level{};
std::cin >> userPressedButton;
if (userPressedButton == "M" || userPressedButton == "m") {
size++;
if (count == 0) {
userInput.start_menu();
std::cin >> userPressedButton;
if (userPressedButton == "H" || userPressedButton == "h") {
userInput.help();
count++;
} else if (userPressedButton == "S" || userPressedButton == "s") {
while (true) {
std::cout << "Please choose your destination (-2 - 10)\n";
if (std::cin >> pressed_level) {
if (pressed_level >= -2 && pressed_level <= 10) {
count++;
break;
} else {
std::cout << "Invalid input. Please enter a valid int.\n";
std::cin.clear();
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); }
} else {
std::cout << "Invalid input. Please enter a valid int.\n";
std::cin.clear();
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
}
}
} else if (userPressedButton == "Q" || userPressedButton == "q") {
std::cout << "Thank you for using our broken ass elevator!!\n";
break;
} else {
std::cout << "\nInput Invalid!!!\nPlease Enter again!!\n";
count = 0;
}
}
} else {
std::cout << "\nInput Invalid!!!\nPlease Enter again!! ('M' or 'm')\n";
size = 0;
}
if (count > 0 && size > 0) {
std::cout << "Do you wish to continue?\n";
std::cout << "[Y/N] ??\n";
std::string dummy{};
std::cin >> dummy;
if (dummy == "Y" || dummy == "y") {
count -- ;
size = 1;
} else if (dummy == "n" || dummy == "N") {
std::cout << "Thank you for using our broken ass elevator!!\n";
break;
}
} else {
std::cout << "Press an acceptable button :)\n";
}
// Process user input
userInput.process_input(pressed_level);
}
*/
return 0;
}