Moved initialization of number of digits from constructor to method.

This commit is contained in:
2023-06-30 15:38:28 +03:00
parent ae4230e721
commit 4b634caf52
5 changed files with 6 additions and 16 deletions

View File

@@ -7,8 +7,9 @@
#include <cwctype>
#include <iostream>
void CGame::Init()
void CGame::Init(int digits)
{
m_ucDigits = digits;
m_fGameIsEnd = false;
m_ucBulls = 0;
m_ucCows = 0;
@@ -146,8 +147,3 @@ bool CGame::IsEqual(int n, int j)
}
return result;
}
CGame::CGame(int d)
{
m_ucDigits = d;
}

View File

@@ -24,8 +24,6 @@ private:
void PrintSteps();
public:
void Init();
void Init(int);
void Start();
CGame(int);
};

View File

@@ -39,7 +39,3 @@ std::pair<int, int> CStep::GetStepAnimals()
{
return m_uStepAnimals;
}
CStep::CStep()
{
}

View File

@@ -14,5 +14,4 @@ public:
void CheckForAnimals(const int*, int);
std::vector<int> GetStepNumber();
std::pair<int, int> GetStepAnimals();
CStep();
};

View File

@@ -9,8 +9,9 @@ int wmain(int argc, wchar_t* argv[])
{
if (!SetUserLocale()) return 1;
CGame game(4);
game.Init();
CGame game;
game.Init(4);
game.Start();
return 0;