Add v1 of Console Input Method

This commit is contained in:
Matti 2024-11-13 21:11:45 +01:00
parent b555d3d5c8
commit 90b0e5bd19

View File

@ -8,6 +8,8 @@
#include <ostream>
#include <random>
#include "../Aufg4/CrimeStats.h"
int getRandomNumberInRange(int min, int max) {
static std::mt19937 generator(static_cast<unsigned int>(time(nullptr)));
std::uniform_int_distribution<int> distribution(min, max);
@ -38,6 +40,18 @@ std::vector<std::string> generateSecretCode(int digits, int optionsPerDigit) {
return secretCode;
}
std::vector<std::string> getCodeGuessFromConsole() {
std::cout << "Have a Guess! :" << std::endl;
std::string input;
std::cin >> input;
std::vector<std::string> guess;
split(input, ' ', guess);
return guess;
}
@ -52,5 +66,9 @@ void Aufg5Main() {
printAllStringsInVector(SecretCode);
std::vector<std::string> guess = getCodeGuessFromConsole();
printAllStringsInVector(guess);
}