Added expandable template for C++ launcher.
This commit is contained in:
13
plates/cpp-launcher/src/CMakeLists.txt
Normal file
13
plates/cpp-launcher/src/CMakeLists.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
###############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2019 Shaun Reed, all rights reserved ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
|
||||
# Create any links we might need
|
||||
set(LIB_LAUNCHER_SRC lib-launcher.cpp)
|
||||
|
||||
# Define our library within CMake and link to the source code
|
||||
add_library(lib-launcher ${LIB_LAUNCHER_SRC})
|
||||
|
||||
80
plates/cpp-launcher/src/lib-launcher.cpp
Normal file
80
plates/cpp-launcher/src/lib-launcher.cpp
Normal file
@@ -0,0 +1,80 @@
|
||||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2019 Shaun Reed, all rights reserved ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################
|
||||
## lib-launcher.cpp
|
||||
*/
|
||||
|
||||
#include <lib-launcher.hpp>
|
||||
|
||||
/* This function allows for selection of the next problem to run.
|
||||
*
|
||||
* @param pSelect - The index to use within our enumeration.
|
||||
* Allows for easy integer to problem selection.
|
||||
*/
|
||||
void RunProblem(Problem pSelect) {
|
||||
|
||||
switch (pSelect) {
|
||||
|
||||
case Problem::One:
|
||||
std::printf("\nYou are on problem 1!\n"
|
||||
"Press enter to continue.");
|
||||
std::cin.ignore();
|
||||
break;
|
||||
|
||||
case Problem::Two:
|
||||
std::printf("\nYou are on problem 2!\n"
|
||||
"Press enter to continue.");
|
||||
std::cin.ignore();
|
||||
break;
|
||||
|
||||
case Problem::Three:
|
||||
std::printf("\nYou are on problem 3!\n"
|
||||
"Press enter to continue.");
|
||||
std::cin.ignore();
|
||||
break;
|
||||
|
||||
case Problem::Four:
|
||||
std::printf("\nYou are on problem 4!\n"
|
||||
"Press enter to continue.");
|
||||
std::cin.ignore();
|
||||
break;
|
||||
|
||||
case Problem::Five:
|
||||
std::printf("\nYou are on problem 5!\n"
|
||||
"Press enter to continue.");
|
||||
std::cin.get();
|
||||
break;
|
||||
|
||||
case Problem::Exit:
|
||||
std::printf("\nYou are on problem 0! This is a safe exit.\n"
|
||||
"Press enter to continue.");
|
||||
std::cin.ignore();
|
||||
break;
|
||||
|
||||
case Problem::Error:
|
||||
std::printf("\nYou are on problem -1! This is considered and error.\n"
|
||||
"Press enter to exit.");
|
||||
std::cin.ignore();
|
||||
break;
|
||||
|
||||
case Problem::Launch:
|
||||
// Do nothing, break and let main() restart the launcher
|
||||
std::printf("\nRestarting the launcher...\n"
|
||||
"Press enter to continue.");
|
||||
std::cin.ignore();
|
||||
break;
|
||||
|
||||
default:
|
||||
std::printf("\nYou have entered an invalid value."
|
||||
"\nPress Enter to try again.");
|
||||
//ProblemList();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user