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 <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;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,6 @@ private:
|
||||
void PrintSteps();
|
||||
|
||||
public:
|
||||
void Init();
|
||||
void Init(int);
|
||||
void Start();
|
||||
|
||||
CGame(int);
|
||||
};
|
||||
|
||||
@@ -39,7 +39,3 @@ std::pair<int, int> CStep::GetStepAnimals()
|
||||
{
|
||||
return m_uStepAnimals;
|
||||
}
|
||||
|
||||
CStep::CStep()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -14,5 +14,4 @@ public:
|
||||
void CheckForAnimals(const int*, int);
|
||||
std::vector<int> GetStepNumber();
|
||||
std::pair<int, int> GetStepAnimals();
|
||||
CStep();
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user