From 90b0e5bd196cf850e7d3d3dd19bc77d35b202e7a Mon Sep 17 00:00:00 2001 From: Matti Date: Wed, 13 Nov 2024 21:11:45 +0100 Subject: [PATCH] Add v1 of Console Input Method --- Aufg5/Mastermind.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Aufg5/Mastermind.cpp b/Aufg5/Mastermind.cpp index 0cdfa41..9abe542 100644 --- a/Aufg5/Mastermind.cpp +++ b/Aufg5/Mastermind.cpp @@ -8,6 +8,8 @@ #include #include +#include "../Aufg4/CrimeStats.h" + int getRandomNumberInRange(int min, int max) { static std::mt19937 generator(static_cast(time(nullptr))); std::uniform_int_distribution distribution(min, max); @@ -38,6 +40,18 @@ std::vector generateSecretCode(int digits, int optionsPerDigit) { return secretCode; } +std::vector getCodeGuessFromConsole() { + std::cout << "Have a Guess! :" << std::endl; + + std::string input; + std::cin >> input; + + std::vector guess; + + split(input, ' ', guess); + + return guess; +} @@ -52,5 +66,9 @@ void Aufg5Main() { printAllStringsInVector(SecretCode); + std::vector guess = getCodeGuessFromConsole(); + + printAllStringsInVector(guess); + }