mirror of
https://gitflic.ru/project/w0lf/bulls-and-cows-cpp.git
synced 2026-03-28 16:02:46 +03:00
Moved initialization of number of digits from constructor to method.
This commit is contained in:
@@ -7,8 +7,9 @@
|
|||||||
#include <cwctype>
|
#include <cwctype>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
void CGame::Init()
|
void CGame::Init(int digits)
|
||||||
{
|
{
|
||||||
|
m_ucDigits = digits;
|
||||||
m_fGameIsEnd = false;
|
m_fGameIsEnd = false;
|
||||||
m_ucBulls = 0;
|
m_ucBulls = 0;
|
||||||
m_ucCows = 0;
|
m_ucCows = 0;
|
||||||
@@ -146,8 +147,3 @@ bool CGame::IsEqual(int n, int j)
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGame::CGame(int d)
|
|
||||||
{
|
|
||||||
m_ucDigits = d;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -24,8 +24,6 @@ private:
|
|||||||
void PrintSteps();
|
void PrintSteps();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Init();
|
void Init(int);
|
||||||
void Start();
|
void Start();
|
||||||
|
|
||||||
CGame(int);
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -39,7 +39,3 @@ std::pair<int, int> CStep::GetStepAnimals()
|
|||||||
{
|
{
|
||||||
return m_uStepAnimals;
|
return m_uStepAnimals;
|
||||||
}
|
}
|
||||||
|
|
||||||
CStep::CStep()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -14,5 +14,4 @@ public:
|
|||||||
void CheckForAnimals(const int*, int);
|
void CheckForAnimals(const int*, int);
|
||||||
std::vector<int> GetStepNumber();
|
std::vector<int> GetStepNumber();
|
||||||
std::pair<int, int> GetStepAnimals();
|
std::pair<int, int> GetStepAnimals();
|
||||||
CStep();
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,8 +9,9 @@ int wmain(int argc, wchar_t* argv[])
|
|||||||
{
|
{
|
||||||
if (!SetUserLocale()) return 1;
|
if (!SetUserLocale()) return 1;
|
||||||
|
|
||||||
CGame game(4);
|
CGame game;
|
||||||
game.Init();
|
|
||||||
|
game.Init(4);
|
||||||
game.Start();
|
game.Start();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user