Added the output of number of total steps at the end of game.

This commit is contained in:
2023-06-30 15:58:57 +03:00
parent 4b634caf52
commit c0dfdf53bb
2 changed files with 4 additions and 3 deletions

View File

@@ -1,7 +1,6 @@
// CGame.cpp // CGame.cpp
// //
#include "CGame.h" #include "CGame.h"
//#include <vector>
#include <string> #include <string>
#include <random> #include <random>
#include <cwctype> #include <cwctype>
@@ -51,6 +50,7 @@ void CGame::Start()
ret = GetNumber(step); ret = GetNumber(step);
if (ret == -1) return; if (ret == -1) return;
} while (ret < 0); } while (ret < 0);
m_uStepCounter++;
} }
PrintGameHeader(); PrintGameHeader();
@@ -85,7 +85,8 @@ void CGame::PrintGameHeader()
void CGame::PrintGameFooter() void CGame::PrintGameFooter()
{ {
std::wcout << L"\n\n\t" << L"!!! П О Б Е Д А !!!" << L"\n\n" << std::endl; std::wcout << L"\n\n\t" << L"!!! П О Б Е Д А !!!" << std::endl;
std::wcout << L"\tКоличество ходов: " << m_uStepCounter << L"\n\n" << std::endl;
} }
void CGame::PrintSteps() void CGame::PrintSteps()

View File

@@ -3,7 +3,7 @@
#include <Windows.h> #include <Windows.h>
#include "..\..\..\MyFunctions\SetUserLocale.h" #include "..\..\..\MyFunctions\SetUserLocale.h"
#include "CGame.h" #include "CGame.h"
#include <iostream> //#include <iostream>
int wmain(int argc, wchar_t* argv[]) int wmain(int argc, wchar_t* argv[])
{ {