#ifndef HELPER_HPP #define HELPER_HPP #include using std::numeric_limits; using std::streamsize; constexpr size_t MAX_STREAM_SIZE = numeric_limits::max(); double InputDouble(const char* Prompt); float InputFloat(const char* Prompt); int InputSelectionInt(const char* Prompt); void Prompts(const char* Prompt); void Prompts(const char* Prompt) { std::cout << Prompt; } double InputDouble(const char* Prompt) { std::cout << Prompt << std::endl; std::cout.flush(); double Value = 0; std::cin >> Value; while (!std::cin) { std::cout << Prompt << std::endl; std::cin.clear(); std::cin.ignore(MAX_STREAM_SIZE, '\n'); std::cin >> Value; } return Value; } float InputFloat(const char* Prompt) { std::cout << Prompt << std::endl; std::cout.flush(); float Value = 0; std::cin >> Value; while (!std::cin) { std::cout << Prompt << std::endl; std::cin.clear(); std::cin.ignore(MAX_STREAM_SIZE, '\n'); std::cin >> Value; } return Value; } int InputSelectionInt(const char* Prompt) { std::cout << Prompt << std::endl; std::cout.flush(); int Value = 0; std::cin >> Value; while (!std::cin) { std::cout << Prompt << std::endl; std::cin.clear(); std::cin.ignore(MAX_STREAM_SIZE, '\n'); std::cin >> Value; } return Value; } #endif