#ifndef GUESSING_HELPER_HPP #define GUESSING_HELPER_HPP #include "CurrencyHelper.hpp" #include int RandomNumberGenerator(const int& LowerBound, const int& UpperBound); void GuessingGame(); int RandomNumberGenerator(const int& LowerBound, const int& UpperBound) { std::random_device dev; std::mt19937 rng(dev()); std::uniform_int_distribution dist(LowerBound, UpperBound); const int Random_Number = dist(rng); return Random_Number; } void GuessingGame() { system("cls"); int GoldenSnitch = 0; int UserGuess = 0; size_t NumberOfGuesses = 0; GoldenSnitch = RandomNumberGenerator(1, 10000); do { UserGuess = InputSelectionInt("Guess a number between 1 and 10,000 :"); system("cls"); if (UserGuess == GoldenSnitch) { std::cout << "\033[32mHooray! YOU WON!!!!$$$$\033[0m" << " It took you #" << NumberOfGuesses << " Tries!!!" << std::endl; return; } if (UserGuess < GoldenSnitch) { std::cout << "Your number is less than the winning value, try a number with a larger magnitude!" << std::endl; } if (UserGuess > GoldenSnitch) { std::cout << "Your number is greater than the winning value, try a number with a smaller magnitude!" << std::endl; } NumberOfGuesses++; if (NumberOfGuesses == 20) { std::cout << "I'm sorry to inform you of your loss, but there's always another day!" << std::endl; } std::cout << "Try #" << NumberOfGuesses << std::endl; } while (NumberOfGuesses != 20); } #endif