diff --git a/Aufg5/Mastermind.cpp b/Aufg5/Mastermind.cpp index b02f85f..efb2151 100644 --- a/Aufg5/Mastermind.cpp +++ b/Aufg5/Mastermind.cpp @@ -87,11 +87,14 @@ int countMatches(std::vector &v1, std::vector &v2) { shorterSize = v2.size(); } + std::vector copyOfv2 = v2; + int count = 0; for (int i = 0; i < shorterSize; i++) { for (int j = 0; j < shorterSize; j++) { - if (v1[i] == v2[j]) { + if (v1[i] == copyOfv2[j]) { count++; + copyOfv2[j] = "I have been counted already"; break; } }