diff --git a/bulls-and-cows-cpp/CGame.cpp b/bulls-and-cows-cpp/CGame.cpp index 6a0a7e9..9217bdb 100644 --- a/bulls-and-cows-cpp/CGame.cpp +++ b/bulls-and-cows-cpp/CGame.cpp @@ -46,7 +46,7 @@ void CGame::Start() do { PrintGameHeader(); - ShowGuessedNumber(false); + ShowGuessedNumber(true); PrintSteps(); ret = GetNumber(step); switch (ret) @@ -169,3 +169,8 @@ int CGame::GetNumber(CStep step) return 0; } + +CGame::~CGame() +{ + delete[] m_uGuessedNumber; +} diff --git a/bulls-and-cows-cpp/CGame.h b/bulls-and-cows-cpp/CGame.h index a171d27..9e0f7c1 100644 --- a/bulls-and-cows-cpp/CGame.h +++ b/bulls-and-cows-cpp/CGame.h @@ -36,18 +36,18 @@ public: void Init(int); void Start(); + + ~CGame(); }; template bool CGame::IsEqual(const T number, const N digit, int i) { - i--; bool result = false; - while (i >= 0) + while ((--i) >= 0) { if (digit == number[i]) result = true; - i--; } return result; }