mirror of
https://gitflic.ru/project/w0lf/bulls-and-cows-cpp.git
synced 2026-03-28 16:02:46 +03:00
Fixed memory leak.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -36,18 +36,18 @@ public:
|
||||
void Init(int);
|
||||
|
||||
void Start();
|
||||
|
||||
~CGame();
|
||||
};
|
||||
|
||||
template<typename T, typename N>
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user