{"id":369246,"date":"2024-05-21T03:59:10","date_gmt":"2024-05-21T03:59:10","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=369246"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=369246","title":{"rendered":"<span>\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0438\u0433\u0440\u0430 \u043d\u0430 C++ (\u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438)<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u041e \u0447\u0435\u043c \u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c<\/h2>\n<p>\u042f \u0441\u0442\u0443\u0434\u0435\u043d\u0442-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442, \u0438 \u043f\u043e\u043a\u0430 \u043d\u0435 \u0434\u043e\u0448\u0451\u043b \u0434\u043e \u0442\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f, \u0447\u0442\u043e\u0431\u044b \u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e\u0435, \u0430 \u0434\u0435\u043b\u0430\u0442\u044c \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u043a\u0438 \u0434\u043b\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438 \u0443\u0436\u0435 \u043a\u0430\u043a-\u0442\u043e \u043d\u0430\u0434\u043e\u0435\u043b\u043e. \u0418 \u0432\u043e\u0442, \u043a\u0430\u043a \u0438, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0443 \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432, \u043c\u043d\u0435 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0441\u0432\u043e\u0451. \u041c\u043e\u0439 \u0432\u044b\u0431\u043e\u0440 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u0435\u0446\u043a\u043e\u0439 \u0438\u0433\u0440\u0435 &#8212; \u0432\u0438\u0441\u0435\u043b\u0438\u0446\u0435, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u043e\u0439 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438. C++ \u044f \u0432\u044b\u0431\u0440\u0430\u043b \u043f\u043e \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0435\u0433\u043e \u0437\u043d\u0430\u044e. \u0417\u0434\u0435\u0441\u044c \u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u0431 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u0445 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430, \u0438 \u043a\u0440\u0430\u0442\u0435\u043d\u044c\u043a\u043e \u0435\u0433\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c.<\/p>\n<h2>\u041a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438\u0433\u0440\u044b<\/h2>\n<p>\u0412\u0438\u0441\u0435\u043b\u0438\u0446\u0430 (Hangman) &#8212; \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0438\u0433\u0440\u0430, \u0446\u0435\u043b\u044c \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0443\u0433\u0430\u0434\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u043e \u0437\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043f\u044b\u0442\u043e\u043a. \u0412\u0430\u0440\u0438\u0430\u0446\u0438\u0439 \u044d\u0442\u043e\u0439 \u0438\u0433\u0440\u044b \u043c\u043d\u043e\u0433\u043e, \u043e\u043d\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u043d\u0430\u043b\u0438\u0447\u0438\u0435\u043c \u0438\u043b\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0442\u0435\u043c, \u0442\u0430\u043a \u0438 \u0440\u0430\u0437\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u043e\u043f\u044b\u0442\u043e\u043a. \u0412 \u043c\u043e\u0435\u043c \u0436\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u0441\u0435\u0433\u043e \u043f\u044f\u0442\u044c \u0442\u0435\u043c ( \u043d\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0435), \u0438 \u0441\u0435\u043c\u044c \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u0433\u0430\u0434\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u043e.<\/p>\n<h2>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u044e Windows <\/h2>\n<p>\u0420\u0430\u0441 \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u044e, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043a\u0430\u043a-\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a \u043d\u0435\u0439 \u0434\u043e\u0441\u0442\u0443\u043f. \u0412 \u044d\u0442\u043e\u043c \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 <strong>Windows API<\/strong>:<\/p>\n<pre><code class=\"cpp\">#include &lt;windows.h> #include &lt;conio.h>  HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);<\/code><\/pre>\n<p><strong>#include &lt;windows.h><\/strong> &#8212; \u044d\u0442\u043e \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b Windows. \u0412 \u043d\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043e\u043a\u043d\u0430\u043c\u0438, \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b .<\/p>\n<p>#<strong>include &lt;conio.h><\/strong> &#8212; \u044d\u0442\u043e \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c. \u0412 \u043d\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0441 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b, \u0432\u044b\u0432\u043e\u0434\u0430 \u0442\u0435\u043a\u0441\u0442\u0430 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u0443\u0440\u0441\u043e\u0440\u043e\u043c.<\/p>\n<p>&#171;<strong>HANDLE<\/strong>&#187; &#8212; \u044d\u0442\u043e \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<p>&#171;<strong>hStdOut<\/strong>&#187; &#8212; \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440.<\/p>\n<p>&#171;<strong>GetStdHandle(STD_OUTPUT_HANDLE)<\/strong>&#187; &#8212; \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0433\u043e \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u043b\u0438 \u0432\u044b\u0432\u043e\u0434\u0430 \u043d\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u043e\u0442\u043e\u043a. <\/p>\n<h2>\u041a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0438 \u0446\u0432\u0435\u0442<\/h2>\n<p>\u0414\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043a\u0430\u043a-\u0442\u043e \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 &#8216;\u043f\u043e\u043b\u043e\u0442\u043d\u0435&#8217;.<\/p>\n<pre><code class=\"cpp\">void SetXY(short X, short Y){     COORD coord = { X, Y };     SetConsoleCursorPosition(hStdOut, coord);<\/code><\/pre>\n<p>\u042f \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <strong>void<\/strong>, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u044f \u0432 \u043d\u0435\u0451 \u0434\u0432\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b (X,Y).   <\/p>\n<p>&#171;<strong>COORD<\/strong>&#187; &#8212; \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u043a\u043e\u043c\u0435\u0441\u0442\u0430 \u0432 \u044d\u043a\u0440\u0430\u043d\u043d\u043e\u043c \u0431\u0443\u0444\u0435\u0440\u0435 \u043a\u043e\u043d\u0441\u043e\u043b\u0438.  \u041d\u0430\u0447\u0430\u043b\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 (0,0) &#8212; \u0432\u0435\u0440\u0445\u043d\u044f\u044f \u043b\u0435\u0432\u0430\u044f \u044f\u0447\u0435\u0439\u043a\u0430. X \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0432\u0441\u0435 \u0438 \u043f\u0440\u0438\u0432\u044b\u043a\u043b\u0438 &#8212; \u0432 \u043f\u0440\u0430\u0432\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443, \u0430 \u0432\u043e\u0442 Y \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0438\u0437. <\/p>\n<p>&#171;<strong>coord<\/strong>&#187; &#8212; \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0441 \u0434\u0432\u0443\u043c\u044f \u043f\u043e\u043b\u044f\u043c\u0438: X \u0438 Y.<\/p>\n<p> &#171;<strong>SetConsoleCursorPosition<\/strong>&#187; &#8212; \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a\u0443\u0440\u0441\u043e\u0440\u0430 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u0431\u0443\u0444\u0435\u0440\u0435 \u044d\u043a\u0440\u0430\u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 .<\/p>\n<p>\u041c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u0441 \u0442\u0435\u043c, \u043a\u0430\u043a \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0447\u0442\u043e-\u043b\u0438\u0431\u043e \u043d\u0430 \u044d\u043a\u0440\u0430\u043d. \u0410 \u0447\u0442\u043e \u043d\u0430 \u0441\u0447\u0435\u0442 \u0446\u0432\u0435\u0442\u0430? \u0417\u0434\u0435\u0441\u044c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0446\u0432\u0435\u0442\u0430, \u043f\u0440\u0438 \u043d\u0443\u0436\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0433\u0443\u0433\u043b\u0438\u0442\u044c \u0438 \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435.<\/p>\n<pre><code class=\"cpp\">enum ConsoleColor {         Black         = 0,         Blue          = 1,         Green         = 2,         Cyan          = 3,         Red           = 4,         Magenta       = 5,         Brown         = 6,         LightGray     = 7,         DarkGray      = 8,         LightBlue     = 9,         LightGreen    = 10,         LightCyan     = 11,         LightRed      = 12,         LightMagenta  = 13,         Yellow        = 14,         White         = 15 };<\/code><\/pre>\n<p>&#171;<strong>enum<\/strong>&#187; &#8212; \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432\u00a0\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432, \u043e\u0442\u043b\u0438\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u043d\u0430\u0431\u043e\u0440 \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0445 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442.<\/p>\n<p>&#171;<strong>ConsoleColor<\/strong>&#187; &#8212; \u044d\u0442\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0446\u0432\u0435\u0442 \u0438 \u0446\u0432\u0435\u0442 \u0444\u043e\u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u0438.  <\/p>\n<p>\u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0446\u0432\u0435\u0442\u0430 \u044f \u0442\u0430\u043a \u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0444\u0443\u043d\u043a\u0446\u0438\u044e <strong>void<\/strong>.<\/p>\n<pre><code class=\"cpp\">void SetColor(ConsoleColor text, ConsoleColor background){     SetConsoleTextAttribute(hStdOut, (WORD)((background) | text)); }<\/code><\/pre>\n<p>&#171;<strong>SetConsoleTextAttribute<\/strong>&#187; \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0446\u0432\u0435\u0442\u0430 <\/p>\n<p>&#171;<strong>WORD<\/strong>&#187; &#8212; \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u0446\u0432\u0435\u0442\u043e\u0432 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0432 Windows.<\/p>\n<p>&#171;<strong>text<\/strong>&#187; \u0438 &#171;<strong>background<\/strong>&#187; &#8212; \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0446\u0432\u0435\u0442\u0430.<\/p>\n<h2>\u0412\u044b\u0432\u043e\u0434 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043e\u0447\u0438\u0441\u0442\u043a\u0430<\/h2>\n<pre><code class=\"cpp\">SetColor(DarkGray, Black); SetXY(0,0); cout &lt;&lt; \"0\" &lt;&lt;endl;<\/code><\/pre>\n<p>\u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0432\u0435\u0441\u044c \u0432\u044b\u0432\u043e\u0434 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0432\u0435\u0442 \u0442\u0435\u043a\u0441\u0442\u0430 \u0438 \u0444\u043e\u043d\u0430, \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a\u0443\u0440\u0441\u043e\u0440\u0430 \u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <strong>cout<\/strong> \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0430\u0434\u043e. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c <strong>SetColor <\/strong>\u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0432\u0441\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u044b\u0432\u043e\u0434\u044b, \u0438 \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u0447\u0435\u043a \u0438\u043b\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u043e\u0434\u043d\u043e\u0433\u043e \u0446\u0432\u0435\u0442\u0430 \u043f\u043e\u0434\u0440\u044f\u0434, \u0442\u043e <strong>SetColor <\/strong>\u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0432\u044b\u0432\u043e\u0434\u0435. <\/p>\n<pre><code class=\"cpp\">  SetColor(Green, Black); SetXY(0,0); cout &lt;&lt; \"00000\" &lt;&lt;endl;   SetXY(1,1); cout &lt;&lt; \"11111\" &lt;&lt;endl;<\/code><\/pre>\n<p>\u041c\u044b \u0432\u044b\u0432\u0435\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0446\u0438\u0444\u0440 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0445 \u0441\u0442\u0435\u0440\u0435\u0442\u044c. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438.<\/p>\n<p>1) \u041c\u043e\u0436\u043d\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0447\u0442\u043e-\u0442\u043e \u0434\u0440\u0443\u0433\u043e\u0435 \u043d\u0430 \u0442\u0435 \u0436\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b. \u041d\u043e \u044d\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u0435\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043a\u043e\u0433\u0434\u0430 \u0434\u043b\u0438\u043d\u0430 \u043d\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043b\u0438\u0431\u043e \u0440\u0430\u0432\u043d\u0430 \u043b\u0438\u0431\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439. \u0415\u0441\u043b\u0438 \u043d\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u0440\u043e\u0447\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 \u043c\u0435\u0441\u0442\u043e &#171;<strong>CARROT<\/strong>&#187; \u0432\u044b\u0432\u0435\u0441\u0442\u0438 &#171;<strong>apple<\/strong>&#171;, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0443\u044e \u0434\u043b\u0438\u043d\u0443, &#171;<strong>appleT<\/strong>&#171;. \u041c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u0435\u043b, \u0435\u0441\u043b\u0438 \u0434\u043b\u0438\u043d\u0430 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u0438 \u043d\u0435 \u043f\u043e\u043c\u0435\u0448\u0430\u0435\u0442 \u0432\u0430\u043c \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c. \u041d\u0430 \u043c\u0435\u0441\u0442\u043e &#171;<strong>CARROT<\/strong>&#187; \u0432\u044b\u0432\u043e\u0434\u0438\u043c &#171;<strong>apple <\/strong>&#187; \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c &#171;<strong>apple <\/strong>&#171;. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0438\u043c\u0432\u043e\u043b \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0431\u0435\u043b, \u0438 \u0435\u0441\u043b\u0438 <strong>background <\/strong>\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0442\u0430\u043a\u043e\u0439 \u0436\u0435, \u0442\u043e \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u043a \u043a\u0430\u043a \u0431\u044b &#171;\u043f\u0443\u0441\u0442\u043e\u0442\u0430&#187;. <\/p>\n<p>2) <strong>ANSI Escape-\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/strong> &#8212; \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0442\u0435\u043a\u0441\u0442\u0430 \u0438 \u043a\u0443\u0440\u0441\u043e\u0440\u043e\u043c \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430\u0445 \u0438 \u043a\u043e\u043d\u0441\u043e\u043b\u044f\u0445. \u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c &#171;<strong>cout &lt;&lt; &#171;\\x1B[2K\\r&#187;<\/strong>&#171;. \u0417\u0434\u0435\u0441\u044c <strong>\\x1B<\/strong> &#8212; \u044d\u0442\u043e \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 ESC, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f ANSI Escape-\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044f\u043c\u0438, <strong>2K<\/strong> &#8212; \u044d\u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0434\u043b\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0432\u0441\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u0430 <strong>\\r<\/strong> &#8212; \u043f\u0435\u0440\u0435\u043d\u043e\u0441 \u043a\u0443\u0440\u0441\u043e\u0440\u0430 \u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u0441\u0442\u0440\u043e\u043a\u0438. \u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u044d\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 Unix-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 (Linux, macOS), \u043d\u043e \u043d\u0430 Windows \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a.<\/p>\n<p>3) \u041f\u043e\u043b\u043d\u0430\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0433\u0434\u0430 \u0443\u0433\u043e\u0434\u043d\u043e, \u0432 \u043c\u043e\u0435\u043c \u0436\u0435 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u0438\u0437 \u043c\u0435\u043d\u044e \u0432 \u0438\u0433\u0440\u0443 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e.<\/p>\n<pre><code class=\"cpp\">... void clearScreen() {     system(\"cls\"); } ... int main(){ ... clearScreen(); ... }<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u0435\u0437\u0443\u043f\u0440\u0435\u0447\u043d\u043e, \u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 &#171;<strong>system(&#171;cls&#187;)<\/strong>&#187; \u043c\u043e\u0436\u0435\u0442 \u0441\u0447\u0438\u0442\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0441\u0430\u043c\u044b\u043c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u044d\u043a\u0440\u0430\u043d\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0432\u043b\u0435\u0447\u044c \u0437\u0430 \u0441\u043e\u0431\u043e\u0439 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u044b \u0438\u043b\u0438 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438. \u0422\u0430\u043a \u0436\u0435 \u0432\u0430\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u043c \u043e\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 \u0432\u0441\u0435\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445.<\/p>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e  &#171;<strong>system(&#171;cls&#187;)<\/strong>&#187; \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c &#171;<strong>cout &lt;&lt; &#171;\\x1B[2J&#187;<\/strong>&#171;, \u0447\u0435\u043c \u044f \u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u0440\u0435\u0448\u0438\u043b \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 <strong>ANSI Escape-\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439<\/strong>.<\/p>\n<p> \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b  \u0444\u0443\u043d\u043a\u0446\u0438\u044e <strong>void<\/strong>, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u043d\u0435 \u0442\u0430\u043a \u0443\u0434\u043e\u0431\u043d\u0435\u0439, \u043d\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e &#171;<strong>system(&#171;cls&#187;)<\/strong>&#187; \u0438\u043b\u0438 &#171;<strong>cout &lt;&lt; &#171;\\x1B[2J&#187;<\/strong>&#187; \u043f\u0440\u044f\u043c\u043e \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <strong>main() <\/strong>\u0438\u043b\u0438 \u043b\u044e\u0431\u043e\u043c \u0434\u0440\u0443\u0433\u043e\u043c \u043c\u0435\u0441\u0442\u0435.<\/p>\n<h2>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043d\u0430\u0436\u0430\u0442\u0438\u0439 \u043d\u0430 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0443 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438  <\/h2>\n<pre><code class=\"cpp\">int main() {     int key;          while (true) {         if (_kbhit()) { \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0431\u044b\u043b\u0430 \u043b\u0438 \u043d\u0430\u0436\u0430\u0442\u0430 \u043a\u043b\u0430\u0432\u0438\u0448\u0430             key = _getch(); \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0436\u0430\u0442\u0443\u044e \u043a\u043b\u0430\u0432\u0438\u0448\u0443             cout &lt;&lt; \"\u041d\u0430\u0436\u0430\u0442\u0430 \u043a\u043b\u0430\u0432\u0438\u0448\u0430: \" &lt;&lt; key &lt;&lt; endl;                          if (key == 27) { \/\/ 27 - ASCII-\u043a\u043e\u0434 \u043a\u043b\u0430\u0432\u0438\u0448\u0438 \"Esc\"                 break; \/\/ \u0412\u044b\u0445\u043e\u0434 \u0438\u0437 \u0446\u0438\u043a\u043b\u0430 \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043a\u043b\u0430\u0432\u0438\u0448\u0438 \"Esc\"             }         }     } }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043d\u0430\u0436\u0430\u0442\u043e\u0439 \u043a\u043b\u0430\u0432\u0438\u0448\u0435 \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e &#171;<strong>key<\/strong>&#171;.<\/p>\n<p>\u0426\u0438\u043a\u043b &#171;<strong>while(true)<\/strong>&#187; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430. \u041a\u043e\u0433\u0434\u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0432 \u0441\u043a\u043e\u0431\u043a\u0430\u0445 \u0440\u0430\u0432\u043d\u043e <strong>true<\/strong>, \u0446\u0438\u043a\u043b \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0440\u0432\u0430\u043d \u0432\u043d\u0443\u0442\u0440\u0438 \u0446\u0438\u043a\u043b\u0430. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e\u0433\u043e \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u0436\u0430\u0442\u044b\u0445 \u043a\u043b\u0430\u0432\u0438\u0448. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u0436\u0438\u0434\u0430\u0442\u044c \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043b\u0430\u0432\u0438\u0448\u0438 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0435\u0435 \u043a\u043e\u0434 <strong>ASCII<\/strong> \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c. \u0415\u0441\u043b\u0438  \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0436\u0430\u0442\u0430 \u043a\u043b\u0430\u0432\u0438\u0448\u0430 &#171;<strong>Esc&#187;<\/strong>, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442 \u0441\u0432\u043e\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 break.<\/p>\n<p>&#171;<strong>_kbhit()<\/strong>&#187; &#8212; \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0431\u044b\u043b\u0430 \u043b\u0438 \u043d\u0430\u0436\u0430\u0442\u0430 \u043a\u0430\u043a\u0430\u044f-\u043b\u0438\u0431\u043e \u043a\u043b\u0430\u0432\u0438\u0448\u0430 \u043d\u0430 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0435. \u041e\u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0435\u043d\u0443\u043b\u0435\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u043d\u0430\u0436\u0430\u0442\u043e\u0439 \u043a\u043b\u0430\u0432\u0438\u0448\u0438, \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043e\u0442\u043b\u0438\u0447\u043d\u043e\u0435 \u043e\u0442 \u043d\u0443\u043b\u044f (\u043e\u0431\u044b\u0447\u043d\u043e 1) \u0435\u0441\u043b\u0438 \u043a\u043b\u0430\u0432\u0438\u0448\u0430 \u0431\u044b\u043b\u0430 \u043d\u0430\u0436\u0430\u0442\u0430.<\/p>\n<p>&#171;<strong>_getch()<\/strong>&#187; &#8212; \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0431\u0435\u0437 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043b\u0430\u0432\u0438\u0448\u0438 Enter. \u041e\u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <strong>ASCII-\u043a\u043e\u0434<\/strong> \u0441\u0438\u043c\u0432\u043e\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u043d\u0430\u0436\u0430\u0442 \u043d\u0430 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0435. \u041e\u0431\u044b\u0447\u043d\u043e \u0435\u0451 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043f\u043e\u0441\u043b\u0435 &#171;<strong>_kbhit()&#187;,<\/strong> \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u043d\u0430\u0436\u0430\u0442.<\/p>\n<p>\u0412 \u043c\u043e\u0435\u043c \u0436\u0435 \u043a\u043e\u0434\u0435 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">int main() { ...     while (true) {          ...          while (key != 's' &amp;&amp; key != 'S' &amp;&amp; key != 27) { \/\/ \u0416\u0434\u0435\u043c \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \"S\" \u0438\u043b\u0438 \"Esc\"                 if (_kbhit()) {                     key = _getch();                     clearScreen();                 }             }             if (key == 27) { \/\/ \u0415\u0441\u043b\u0438 \"Esc\" \u0431\u044b\u043b\u0430 \u043d\u0430\u0436\u0430\u0442\u0430, \u0432\u044b\u0445\u043e\u0434 \u0438\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b                 break;             }     } }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c, \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0446\u0438\u043a\u043b <strong>while<\/strong> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043a\u0430\u043a\u0430\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u043a\u043b\u0430\u0432\u0438\u0448\u0430 \u0431\u044b\u043b\u0430 \u043d\u0430\u0436\u0430\u0442\u0430, \u0438 \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 &#171;<strong>S<\/strong>&#171;, \u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0435\u0439 &#171;<strong>Start&#187;<\/strong>, \u043e\u0447\u0438\u0449\u0430\u0435\u0442\u0441\u044f \u044d\u043a\u0440\u0430\u043d \u0438 \u0446\u0438\u043a\u043b \u0438\u0433\u0440\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u043d\u043e\u0432\u043e, \u0430 \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 &#171;<strong>Esc<\/strong>&#187; \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0435\u0442 \u0446\u0438\u043a\u043b, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0437\u0430\u043a\u0440\u044b\u0442\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443.<\/p>\n<h2>\u0412\u044b\u0431\u043e\u0440 \u0442\u0435\u043c\u044b<\/h2>\n<pre><code class=\"cpp\">#include &lt;ctime> ... vector &lt;int> wordsKey = {1, 2 ,3 ,4 ,5 }; vector &lt;string> wordsA = {...}; ... while (!(key == 'a' || key == 'A' ...)) {         if (_kbhit()) {             key = _getch();             if (key == 'r' || key == 'R') {                 key = wordsKey[rand() % wordsKey.size()];                 break;             }         }     } ... void ChooseWord(){         if (key == 'a' || key == 'A' || key == 1){         word = wordsA[rand() % wordsA.size()];     }     ...   } ... int main(){   srand(time(NULL));   ... }<\/code><\/pre>\n<p>\u0412 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0442\u0435\u043c \u043f\u044f\u0442\u044c, \u0438 \u0446\u0438\u043a\u043b \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043a\u043b\u0430\u0432\u0438\u0448. \u041f\u043b\u044e\u0441\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0443\u044e \u0442\u0435\u043c\u0443 \u043d\u0430\u0436\u0430\u0442\u0438\u0435\u043c  \u043d\u0430 &#171;<strong>R<\/strong>&#187;  &#8212; &#171;<strong>key = wordsKey[rand() % wordsKey.size()]<\/strong>&#187; \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f key \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u044f\u0442\u044c\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u043c\u0443 \u0447\u0438\u0441\u043b\u0443 \u0438\u0437 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 &#171;<strong>wordsKey<\/strong>&#171;.<\/p>\n<p>\u0421\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0432\u044b\u0431\u043e\u0440 \u0431\u044b\u043b \u0441\u0434\u0435\u043b\u0430\u043d \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e &#171;<strong>srand(time(NULL))<\/strong>&#187; &#8212; \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043f\u0441\u0435\u0432\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b. &#171;<strong>time(NULL)<\/strong>&#187; \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445. \u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 &#171;<strong>time(NULL)<\/strong>&#187; \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f &#171;<strong>srand<\/strong>&#171;, \u043c\u044b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043f\u0441\u0435\u0432\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u043d\u043e\u0432\u044b\u043c \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. <\/p>\n<p>&#171;<strong>word = wordsA[rand() % wordsA.size()]<\/strong>&#171;. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u043c\u044b \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432\u0435\u043a\u0442\u043e\u0440\u0430, \u043d\u043e\u043c\u0435\u0440 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0440\u0430\u0432\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0441\u0442\u0430\u0442\u043a\u0443 \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0441\u0435\u0432\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u043d\u0430 \u0434\u043b\u0438\u043d\u0443 \u0432\u0435\u043a\u0442\u043e\u0440\u0430.<\/p>\n<h2>\u0412\u0432\u043e\u0434 \u0441\u043b\u043e\u0432\u0430<\/h2>\n<pre><code class=\"cpp\">int attemptsLeft = 7; int enterX = ...; char guess; ... SetXY(X,Y); cout &lt;&lt; \"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0431\u0443\u043a\u0432\u0443: \"; ... while (attemptsLeft > 0 &amp;&amp; !isWordGuessed()){   ...     printGuessedWord();        enterX++;     SetXY(enterX,Y);     cin >> guess;     ... }<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f &#171;<strong>attemptsLeft<\/strong>&#187; \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0447\u0438\u0441\u043b\u043e \u043f\u043e\u043f\u044b\u0442\u043e\u043a (\u043e\u0448\u0438\u0431\u043e\u043a), \u0432 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0441\u0435\u043c\u044c.<\/p>\n<p>\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f &#171;<strong>enterX<\/strong>&#187; \u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0447\u0438\u0441\u043b\u043e &#8212; \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043a\u0443\u0440\u0441\u043e\u0440\u0430 \u043f\u043e \u043e\u0441\u0438 <strong>X<\/strong>, \u043d\u0430 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442\u0441\u044f \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u043d\u0430\u043c\u0438 \u0431\u0443\u043a\u0432\u044b.<\/p>\n<p>\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f &#171;<strong>guess<\/strong>&#187; \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u0443\u044e \u0431\u0443\u043a\u0432\u0443, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0435\u0451 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432 \u0437\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u043e\u0432\u0435. <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0439 \u0431\u0443\u043a\u0432\u044b, \u043a \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0435 <strong>X<\/strong> \u043a\u0443\u0440\u0441\u043e\u0440\u0430 \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0435\u0434\u0438\u043d\u0438\u0446\u0430 &#171;<strong>enterX++<\/strong>&#171;, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c, \u043f\u0440\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0438 \u0446\u0438\u043a\u043b\u0430 <strong>while<\/strong> \u043a\u0443\u0440\u0441\u043e\u0440 \u043f\u0435\u0440\u0435\u0434\u0432\u0438\u043d\u0435\u0442\u0441\u044f \u0432\u043f\u0440\u0430\u0432\u043e \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443.<\/p>\n<p>\u0412\u0430\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0442\u0438\u043f\u0430 <strong>char <\/strong>\u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432 \u0441\u0435\u0431\u0435 \u043b\u0438\u0448\u044c \u043e\u0434\u043d\u0443 \u0431\u0443\u043a\u0432\u0443, \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0432\u0432\u0435\u0434\u0435\u043c \u0441\u0440\u0430\u0437\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0443\u043a\u0432, \u0446\u0438\u043a\u043b <strong>while<\/strong> \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043a\u0430\u0436\u0434\u043e\u0439 \u0431\u0443\u043a\u0432\u043e\u0439 \u043f\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0438.<\/p>\n<pre><code class=\"cpp\">string guessedLetters; ... if (word.find(guess) != string::npos) {     guessedLetters += guess; } else {     attemptsLeft--; }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0436\u0435 <strong>if<\/strong> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u043b\u0438 \u0431\u0443\u043a\u0432\u0430 \u0438\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 &#171;<strong>guess<\/strong>&#187; \u0432 \u0441\u043b\u043e\u0432\u0435 &#171;<strong>word<\/strong>&#171;. \u041c\u0435\u0442\u043e\u0434 <strong>find()<\/strong> \u0438\u0449\u0435\u0442 \u043f\u0435\u0440\u0432\u043e\u0435 \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0438 &#171;<strong>guess<\/strong>&#187; \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 &#171;<strong>word<\/strong>&#171;. \u0415\u0441\u043b\u0438 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u0440\u0430\u0432\u043d\u043e &#171;<strong>string::npos<\/strong>&#171;, \u0442\u043e \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0431\u0443\u043a\u0432\u0430 \u0431\u044b\u043b\u0430 \u0443\u0433\u0430\u0434\u0430\u043d\u0430 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 &#171;<strong>guessedLetters&#187; <\/strong>\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0445\u0440\u0430\u043d\u0438\u0442 \u0432\u0441\u0435 \u0443\u0433\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u043a\u0432\u044b.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0436\u0435 \u0431\u0443\u043a\u0432\u0430 \u043d\u0435 \u0431\u044b\u043b\u0430 \u0443\u0433\u0434\u0430\u043d\u0430, \u0442\u043e \u043c\u044b \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043f\u044b\u0442\u043e\u043a &#171;<strong>attemptsLeft&#8212;<\/strong>&#171;.<\/p>\n<p>&#171;<strong>string::npos<\/strong>&#187; \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 <strong>string<\/strong>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"cpp\">bool isWordGuessed() {     for (char c : word) {         if (guessedLetters.find(c) == string::npos) {             return false;         }     }     return true; }<\/code><\/pre>\n<p>\u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0431\u044b\u043b\u0438 \u043b\u0438 \u0432\u0441\u0435 \u0431\u0443\u043a\u0432\u044b \u0438\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <strong>word<\/strong> \u0443\u0433\u0430\u0434\u0430\u043d\u044b, \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043b\u0438 \u043e\u043d\u0438 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 &#171;<strong>guessedLetters<\/strong>&#171;. \u0415\u0441\u043b\u0438 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u043d\u0430 \u0431\u0443\u043a\u0432\u0430 \u0438\u0437 \u0437\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 \u043d\u0435 \u0431\u044b\u043b\u0430 \u0443\u0433\u0430\u0434\u0430\u043d\u0430, \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u0435\u0440\u043d\u0435\u0442 <strong>false<\/strong>, \u0438\u043d\u0430\u0447\u0435 \u0432\u0435\u0440\u043d\u0435\u0442 <strong>true<\/strong>.<\/p>\n<pre><code class=\"cpp\">int length = word.length(); ... void printGuessedWord() {     int m = (Xx - length\/2);     SetXY(m,Y);     for (char c : word) {         if (guessedLetters.find(c) != string::npos) {             cout &lt;&lt; c;         } else          {             cout &lt;&lt; \"_\";         }     } }<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e &#171;<strong>printGuessedWord()<\/strong>&#171;, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0443\u0433\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u043a\u0432 \u0438 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043e\u0432 \u0432 \u0441\u043b\u043e\u0432\u0435 word \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u0441\u043b\u043e\u0432\u0430 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u043e \u043c\u0435\u0441\u0442\u0435, \u044d\u0442\u043e \u0431\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u043e \u043d\u0435 \u043e\u0441\u043e\u0431\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u043e \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0432\u0435\u0434\u044c \u043e\u043d\u0438 \u0432\u0441\u0435 \u0438\u043c\u0435\u044e\u0442 \u0440\u0430\u0437\u043d\u0443\u044e \u0434\u043b\u0438\u043d\u0443. \u042f \u0436\u0435 \u0440\u0435\u0448\u0438\u043b \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u043b\u043e\u0432\u043e, \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u0432 \u0435\u0433\u043e \u0446\u0435\u043d\u0442\u0440 \u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0435. \u0422\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0441\u043b\u043e\u0432\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435, \u043d\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430 \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043b\u043e\u0432\u0430 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 \u0435\u0433\u043e \u0434\u043b\u0438\u043d\u044b. <\/p>\n<p>\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f &#171;<strong>length<\/strong>&#187; \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0434\u043b\u0438\u043d\u0443 \u0437\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430.<\/p>\n<p>\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f &#171;<strong>m<\/strong>&#187; \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043f\u043e \u043e\u0441\u0438 <strong>X<\/strong> \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0441\u043b\u043e\u0432\u0430. \u041e\u043d\u0430 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c <strong>Xx<\/strong> &#8212; \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0435, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0446\u0435\u043d\u0442\u0440 \u0441\u043b\u043e\u0432\u0430 \u0438 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b \u0441\u043b\u043e\u0432\u0430 &#171;<strong>length\/2<\/strong>&#171;.<\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0446\u0438\u043a\u043b <strong>for<\/strong> \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u0442 \u043a\u0430\u0436\u0434\u0443\u044e \u0431\u0443\u043a\u0432\u0443 c \u0432 \u0437\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u043e\u0432\u0435. \u0415\u0441\u043b\u0438 \u0431\u0443\u043a\u0432\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432  &#171;<strong>guessedLetters<\/strong>&#171;, \u0442.\u0435. \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u0443\u0433\u0430\u0434\u0430\u043d\u0430, \u0442\u043e \u043e\u043d\u0430 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u043d\u0430 \u0442\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043d\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0437\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u043e\u0432\u0435. \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0441\u043b\u043e\u0432\u0430 \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f &#171;<strong>_<\/strong>&#187; \u0432\u043e \u0432\u0441\u044e \u0435\u0433\u043e \u0434\u043b\u0438\u043d\u0443, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043d\u044f\u0442\u044c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0443\u043a\u0432 \u0432 \u0441\u043b\u043e\u0432\u0435.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0421\u0447\u0438\u0442\u0430\u044e, \u0447\u0442\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b \u043e \u0432\u0441\u0451\u043c, \u043e \u0447\u0451\u043c \u0445\u043e\u0442\u0435\u043b. \u041e\u043f\u044b\u0442\u0430 \u0432 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u0443 \u043c\u0435\u043d\u044f \u043d\u0435\u0442, \u043f\u0438\u0448\u0443 \u0432 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437, \u0438 \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u0422\u0430\u043a \u0436\u0435 \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0442\u043e, \u043e \u0447\u0451\u043c \u044f \u0442\u0443\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043b, \u043c\u043e\u0436\u0435\u0442 \u043a\u043e\u043c\u0443-\u0442\u043e \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u044c\u0441\u044f. \u041d\u0438\u0436\u0435 \u044f \u043e\u0441\u0442\u0430\u0432\u043b\u044e \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0439\u0441\u044f \u0438\u0433\u0440\u044b.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0434\u0440\u0443\u0433 \u0433\u0434\u0435-\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0430, \u043e\u043f\u0438\u0441\u043a\u0430 \u0438\u043b\u0438 \u043d\u0435\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c, \u0438\u043b\u0438 \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0447\u0442\u043e-\u0442\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u044c, \u0442\u043e \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438. \u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0447\u0438\u0442\u0430\u044e, \u0438 \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e, \u0442\u043e \u0432\u0441\u0451 \u0432\u044b\u0448\u0435\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u044e. \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0447\u0442\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u0438!<\/p>\n<hr\/>\n<pre><code class=\"cpp\">    #include &lt;iostream>     #include &lt;string>     #include &lt;vector>     #include &lt;ctime>     #include &lt;windows.h>     #include &lt;conio.h>      using namespace std;      HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);      vector &lt;int> wordsKey = {1, 2 ,3 ,4 ,5 };     vector &lt;string> wordsA = {\"fish\", \"dog\", \"cat\", \"elephant\", \"lion\", \"tiger\", \"monkey\", \"zebra\", \"giraffe\", \"bear\", \"kangaroo\", \"koala\", \"penguin\", \"seal\", \"hippo\", \"chiken\", \"wolf\", \"panda\", \"frog\", \"owl\", \"bunny\", \"ladybug\", \"fox\", \"dragonfly\", \"sheep\", \"octopus\", \"butterfly\", \"whale\", \"sheep\", \"horse\", \"goat\", \"pig\", \"snake\"};     vector &lt;string> wordsP = {\"flower\", \"tree\", \"grass\", \"sunflower\", \"rose\", \"cactus\", \"lily\", \"dandelion\", \"tulip\",  \"oak\", \"birch\", \"pine\", \"iris\", \"lotus\", \"violet\", \"dandelion\"};     vector &lt;string> wordsF = {\"apple\", \"peach\", \"banana\", \"orange\", \"strawberry\", \"grapefruit\", \"carrot\", \"potato\", \"sandwich\", \"chicken\", \"beef\", \"salad\", \"cake\"};     vector &lt;string> wordsC = {\"dress\", \"shirt\", \"pants\", \"skirt\", \"jeans\", \"sweater\", \"jacket\", \"hat\", \"shoes\", \"socks\", \"gloves\", \"scarf\", \"bra\", \"panties\", \"boots\", \"junper\", \"blouse\"};     vector &lt;string> wordsI = {\"pencil\", \"book\", \"chair\", \"table\", \"computer\", \"desk\", \"notebook\", \"pen\", \"calculator\", \"clock\", \"backpack\", \"ruler\", \"scissors\", \"marker\", \"board\"};     string word, guessedLetters;     int length, key;      void SetXY(short X, short Y){         COORD coord = { X, Y };         SetConsoleCursorPosition(hStdOut, coord);     }      enum ConsoleColor{         Black         = 0,         Blue          = 1,         Green         = 2,         Cyan          = 3,         Red           = 4,         Brown         = 6,         LightGray     = 7,         DarkGray      = 8,         LightBlue     = 9,         LightGreen    = 10,         LightCyan     = 11,         LightRed      = 12,         White         = 15     };      void SetColor(ConsoleColor text, ConsoleColor background){         SetConsoleTextAttribute(hStdOut, (WORD)((background) | text));     }      void Start() {         SetColor(Cyan, Black); SetXY(12,3); cout &lt;&lt; \"To start the game, select a theme:\" &lt;&lt; endl;         SetColor(LightCyan, Black);         SetXY(12,5); cout &lt;&lt; \"Animals - 'A'.       Plants - 'P'.\" &lt;&lt; endl;         SetXY(24,7); cout &lt;&lt; \"Food - 'F'.\" &lt;&lt; endl;         SetXY(12,9); cout &lt;&lt; \"Clothes - 'C'.        Items - 'I'.\"&lt;&lt; endl;         SetXY(20,11); cout &lt;&lt; \"Random theme - 'R'.\" &lt;&lt; endl;         SetColor(DarkGray, Black); SetXY(10,13); cout &lt;&lt; \"(To select, press the appropriate key)\" &lt;&lt; endl;          while (!(key == 'a' || key == 'A' || key == 'p' || key == 'P' || key == 'f' || key == 'F' || key == 'c' || key == 'C' || key == 'i' || key == 'I')) {             if (_kbhit()) {                 key = _getch();                 if (key == 'r' || key == 'R') {                     key = wordsKey[rand() % wordsKey.size()];                     break;                 }             }         }     }       void ChooseWord(){             if (key == 'a' || key == 'A' || key == 1){             word = wordsA[rand() % wordsA.size()];             SetColor(Cyan , Black); SetXY(3,17); cout &lt;&lt; \"Theme: animals.\" &lt;&lt; endl;         }         else if (key == 'p' || key == 'P' || key == 2){             word = wordsP[rand() % wordsP.size()];             SetColor(Cyan , Black); SetXY(3,17); cout &lt;&lt; \"Theme: plants.\" &lt;&lt; endl;         }         else if (key == 'f' || key == 'F' || key == 3){             word = wordsF[rand() % wordsF.size()];             SetColor(Cyan , Black); SetXY(3,17); cout &lt;&lt; \"Theme: food.\" &lt;&lt; endl;         }         else if (key == 'c' || key == 'C' || key == 4){             word = wordsC[rand() % wordsC.size()];             SetColor(Cyan , Black); SetXY(3,17); cout &lt;&lt; \"Theme: clothes.\" &lt;&lt; endl;         }         else if (key == 'i' || key == 'I' || key == 5){             word = wordsI[rand() % wordsI.size()];             SetColor(Cyan , Black); SetXY(3,17); cout &lt;&lt; \"Theme: item.\" &lt;&lt; endl;         }        }      void Walls() {         SetColor(Blue, Black);                  for (int m = 15; m &lt; 31; m++) {             SetXY(m, 5); cout &lt;&lt; \"*\";             SetXY(m, 14); cout &lt;&lt; \"*\";         }                  for (int m = 6; m &lt; 14; m++) {             SetXY(15, m); cout &lt;&lt; \"*\";             SetXY(30, m); cout &lt;&lt; \"*\";         }     }      bool isWordGuessed() {         for (char c : word) {             if (guessedLetters.find(c) == string::npos) {                 return false;             }         }         return true;     }      void printHangman(int attemptsLeft) {     SetColor(Brown , Black);     if (attemptsLeft == 7) {         for(int m = 19; m &lt; 26 ; m++) {             SetXY(m,6); cout &lt;&lt;\"_\";         }          for(int m = 7; m &lt; 13 ; m++) {             SetXY(18,m); cout &lt;&lt;\"|\";         }     } else if (attemptsLeft == 6) {         SetColor(DarkGray, Black); SetXY(26,7); cout &lt;&lt; \"|\"&lt;&lt;endl;     } else if (attemptsLeft == 5) {         SetColor(White , Black); SetXY(26,8); cout &lt;&lt; \"0\"&lt;&lt;endl;     } else if (attemptsLeft == 4) {         SetColor(White , Black); SetXY(26,9); cout &lt;&lt; \"|\"&lt;&lt;endl;     } else if (attemptsLeft == 3) {         SetColor(White , Black); SetXY(25,9); cout &lt;&lt; \"\/\"&lt;&lt;endl;     } else if (attemptsLeft == 2) {         SetColor(White , Black); SetXY(27,9); cout &lt;&lt; \"\\\\\"&lt;&lt;endl;     } else if (attemptsLeft == 1) {         SetColor(White , Black); SetXY(25,10); cout &lt;&lt; \"\/\"&lt;&lt;endl;     } else if (attemptsLeft == 0) {         SetColor(White , Black); SetXY(27,10); cout &lt;&lt; \"\\\\\"&lt;&lt;endl;     }     }      void printGuessedWord() {         SetColor(LightCyan, Black);         int m = (23 - length\/2);         SetXY(m,15);         for (char c : word) {             if (guessedLetters.find(c) != string::npos) {                 cout &lt;&lt; c;             } else { cout &lt;&lt; \"_\"; }         }     }      void clearScreen() {         system(\"cls\");     }      int main() {          srand(time(NULL));         SetColor(LightGreen, Black); SetXY(19,1); cout &lt;&lt;\"Welcome to Hangman!\" &lt;&lt; endl;          while (true) {               Start();             clearScreen();              Walls();             SetColor(LightRed, Black); SetXY(3,50); cout &lt;&lt; \"The author of this something - Mustafaev Emil aka DarkmMoonDm.\";              ChooseWord();             length = word.length();              int attemptsLeft = 7;              SetXY(3,18); cout &lt;&lt; \"Enter the letter: \";              int enterX = 20;             char guess;                          while (attemptsLeft > 0 &amp;&amp; !isWordGuessed()){                  SetColor(Cyan, Black); SetXY(5,2); cout &lt;&lt; \"You have   attempts to guess the word.\";                 SetXY(14,2); cout &lt;&lt; attemptsLeft;                  printHangman(attemptsLeft);                  SetColor(Cyan , Black);                 printGuessedWord();                  enterX++;                 SetColor(LightCyan, Black); SetXY(enterX,18);                 cin >> guess;                  if (word.find(guess) != string::npos) {                     SetColor(Green, Black); SetXY(19,4); cout &lt;&lt; \"Correct!\" &lt;&lt; endl;                     guessedLetters += guess;                 } else {                     SetColor(Red, Black); SetXY(19,4);cout &lt;&lt; \" Wrong! \" &lt;&lt; endl;                     attemptsLeft--;                 }             }              printHangman(attemptsLeft);              if (isWordGuessed()) {                 int m = (23 - length\/2);                 SetColor(LightCyan, Black); SetXY(m,15); cout &lt;&lt; word;                 m = 58-((39+length)\/2);                 SetColor(Green, Black); SetXY(m,8); cout &lt;&lt; \"Congratulations, you guessed the word: \" &lt;&lt; word &lt;&lt; '.' &lt;&lt; endl;             } else              {                 SetColor(Cyan, Black); SetXY(14,2); cout &lt;&lt; \"0\";                 int m = 58-((30+length)\/2);                 SetColor(Red, Black); SetXY(m,8) ;cout &lt;&lt; \"You couldn't guess the word: \" &lt;&lt; word &lt;&lt; '.'&lt;&lt; endl;             }              SetColor(White, Black);             SetXY(43,10); cout &lt;&lt; \"To start a new game, press'S'.\" &lt;&lt; endl;             SetXY(48,11); cout &lt;&lt; \"To exit, press 'Esc'.\" &lt;&lt; endl;             while (key != 's' &amp;&amp; key != 'S' &amp;&amp; key != 27) {                  if (_kbhit()) {                     key = _getch();                     clearScreen();                 }             }             if (key == 27) {break;}              length, key =  0;             word = \"\";             guessedLetters = \"\";         }     }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/796261\/\"> https:\/\/habr.com\/ru\/articles\/796261\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u041e \u0447\u0435\u043c \u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c<\/h2>\n<p>\u042f \u0441\u0442\u0443\u0434\u0435\u043d\u0442-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442, \u0438 \u043f\u043e\u043a\u0430 \u043d\u0435 \u0434\u043e\u0448\u0451\u043b \u0434\u043e \u0442\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f, \u0447\u0442\u043e\u0431\u044b \u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e\u0435, \u0430 \u0434\u0435\u043b\u0430\u0442\u044c \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u043a\u0438 \u0434\u043b\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438 \u0443\u0436\u0435 \u043a\u0430\u043a-\u0442\u043e \u043d\u0430\u0434\u043e\u0435\u043b\u043e. \u0418 \u0432\u043e\u0442, \u043a\u0430\u043a \u0438, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0443 \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432, \u043c\u043d\u0435 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0441\u0432\u043e\u0451. \u041c\u043e\u0439 \u0432\u044b\u0431\u043e\u0440 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u0435\u0446\u043a\u043e\u0439 \u0438\u0433\u0440\u0435 &#8212; \u0432\u0438\u0441\u0435\u043b\u0438\u0446\u0435, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u043e\u0439 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438. C++ \u044f \u0432\u044b\u0431\u0440\u0430\u043b \u043f\u043e \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0435\u0433\u043e \u0437\u043d\u0430\u044e. \u0417\u0434\u0435\u0441\u044c \u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u0431 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u0445 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430, \u0438 \u043a\u0440\u0430\u0442\u0435\u043d\u044c\u043a\u043e \u0435\u0433\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c.<\/p>\n<h2>\u041a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438\u0433\u0440\u044b<\/h2>\n<p>\u0412\u0438\u0441\u0435\u043b\u0438\u0446\u0430 (Hangman) &#8212; \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0438\u0433\u0440\u0430, \u0446\u0435\u043b\u044c \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0443\u0433\u0430\u0434\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u043e \u0437\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043f\u044b\u0442\u043e\u043a. \u0412\u0430\u0440\u0438\u0430\u0446\u0438\u0439 \u044d\u0442\u043e\u0439 \u0438\u0433\u0440\u044b \u043c\u043d\u043e\u0433\u043e, \u043e\u043d\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u043d\u0430\u043b\u0438\u0447\u0438\u0435\u043c \u0438\u043b\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0442\u0435\u043c, \u0442\u0430\u043a \u0438 \u0440\u0430\u0437\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u043e\u043f\u044b\u0442\u043e\u043a. \u0412 \u043c\u043e\u0435\u043c \u0436\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u0441\u0435\u0433\u043e \u043f\u044f\u0442\u044c \u0442\u0435\u043c ( \u043d\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0435), \u0438 \u0441\u0435\u043c\u044c \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u0433\u0430\u0434\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u043e.<\/p>\n<h2>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u044e Windows <\/h2>\n<p>\u0420\u0430\u0441 \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u044e, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043a\u0430\u043a-\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a \u043d\u0435\u0439 \u0434\u043e\u0441\u0442\u0443\u043f. \u0412 \u044d\u0442\u043e\u043c \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 <strong>Windows API<\/strong>:<\/p>\n<pre><code class=\"cpp\">#include &lt;windows.h> #include &lt;conio.h>  HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);<\/code><\/pre>\n<p><strong>#include &lt;windows.h><\/strong> &#8212; \u044d\u0442\u043e \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b Windows. \u0412 \u043d\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043e\u043a\u043d\u0430\u043c\u0438, \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b .<\/p>\n<p>#<strong>include &lt;conio.h><\/strong> &#8212; \u044d\u0442\u043e \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c. \u0412 \u043d\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0441 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b, \u0432\u044b\u0432\u043e\u0434\u0430 \u0442\u0435\u043a\u0441\u0442\u0430 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u0443\u0440\u0441\u043e\u0440\u043e\u043c.<\/p>\n<p>&#171;<strong>HANDLE<\/strong>&#187; &#8212; \u044d\u0442\u043e \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<p>&#171;<strong>hStdOut<\/strong>&#187; &#8212; \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440.<\/p>\n<p>&#171;<strong>GetStdHandle(STD_OUTPUT_HANDLE)<\/strong>&#187; &#8212; \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0433\u043e \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u043b\u0438 \u0432\u044b\u0432\u043e\u0434\u0430 \u043d\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u043e\u0442\u043e\u043a. <\/p>\n<h2>\u041a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0438 \u0446\u0432\u0435\u0442<\/h2>\n<p>\u0414\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043a\u0430\u043a-\u0442\u043e \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 &#8216;\u043f\u043e\u043b\u043e\u0442\u043d\u0435&#8217;.<\/p>\n<pre><code class=\"cpp\">void SetXY(short X, short Y){     COORD coord = { X, Y };     SetConsoleCursorPosition(hStdOut, coord);<\/code><\/pre>\n<p>\u042f \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <strong>void<\/strong>, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u044f \u0432 \u043d\u0435\u0451 \u0434\u0432\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b (X,Y).   <\/p>\n<p>&#171;<strong>COORD<\/strong>&#187; &#8212; \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u043a\u043e\u043c\u0435\u0441\u0442\u0430 \u0432 \u044d\u043a\u0440\u0430\u043d\u043d\u043e\u043c \u0431\u0443\u0444\u0435\u0440\u0435 \u043a\u043e\u043d\u0441\u043e\u043b\u0438.  \u041d\u0430\u0447\u0430\u043b\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 (0,0) &#8212; \u0432\u0435\u0440\u0445\u043d\u044f\u044f \u043b\u0435\u0432\u0430\u044f \u044f\u0447\u0435\u0439\u043a\u0430. X \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0432\u0441\u0435 \u0438 \u043f\u0440\u0438\u0432\u044b\u043a\u043b\u0438 &#8212; \u0432 \u043f\u0440\u0430\u0432\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443, \u0430 \u0432\u043e\u0442 Y \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0438\u0437. <\/p>\n<p>&#171;<strong>coord<\/strong>&#187; &#8212; \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0441 \u0434\u0432\u0443\u043c\u044f \u043f\u043e\u043b\u044f\u043c\u0438: X \u0438 Y.<\/p>\n<p> &#171;<strong>SetConsoleCursorPosition<\/strong>&#187; &#8212; \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a\u0443\u0440\u0441\u043e\u0440\u0430 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u0431\u0443\u0444\u0435\u0440\u0435 \u044d\u043a\u0440\u0430\u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 .<\/p>\n<p>\u041c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u0441 \u0442\u0435\u043c, \u043a\u0430\u043a \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0447\u0442\u043e-\u043b\u0438\u0431\u043e \u043d\u0430 \u044d\u043a\u0440\u0430\u043d. \u0410 \u0447\u0442\u043e \u043d\u0430 \u0441\u0447\u0435\u0442 \u0446\u0432\u0435\u0442\u0430? \u0417\u0434\u0435\u0441\u044c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0446\u0432\u0435\u0442\u0430, \u043f\u0440\u0438 \u043d\u0443\u0436\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0433\u0443\u0433\u043b\u0438\u0442\u044c \u0438 \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435.<\/p>\n<pre><code class=\"cpp\">enum ConsoleColor {         Black         = 0,         Blue          = 1,         Green         = 2,         Cyan          = 3,         Red           = 4,         Magenta       = 5,         Brown         = 6,         LightGray     = 7,         DarkGray      = 8,         LightBlue     = 9,         LightGreen    = 10,         LightCyan     = 11,         LightRed      = 12,         LightMagenta  = 13,         Yellow        = 14,         White         = 15 };<\/code><\/pre>\n<p>&#171;<strong>enum<\/strong>&#187; &#8212; \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432\u00a0\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432, \u043e\u0442\u043b\u0438\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u043d\u0430\u0431\u043e\u0440 \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0445 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442.<\/p>\n<p>&#171;<strong>ConsoleColor<\/strong>&#187; &#8212; \u044d\u0442\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0446\u0432\u0435\u0442 \u0438 \u0446\u0432\u0435\u0442 \u0444\u043e\u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u0438.  <\/p>\n<p>\u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0446\u0432\u0435\u0442\u0430 \u044f \u0442\u0430\u043a \u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0444\u0443\u043d\u043a\u0446\u0438\u044e <strong>void<\/strong>.<\/p>\n<pre><code class=\"cpp\">void SetColor(ConsoleColor text, ConsoleColor background){     SetConsoleTextAttribute(hStdOut, (WORD)((background) | text)); }<\/code><\/pre>\n<p>&#171;<strong>SetConsoleTextAttribute<\/strong>&#187; \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0446\u0432\u0435\u0442\u0430 <\/p>\n<p>&#171;<strong>WORD<\/strong>&#187; &#8212; \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u0446\u0432\u0435\u0442\u043e\u0432 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0432 Windows.<\/p>\n<p>&#171;<strong>text<\/strong>&#187; \u0438 &#171;<strong>background<\/strong>&#187; &#8212; \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0446\u0432\u0435\u0442\u0430.<\/p>\n<h2>\u0412\u044b\u0432\u043e\u0434 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043e\u0447\u0438\u0441\u0442\u043a\u0430<\/h2>\n<pre><code class=\"cpp\">SetColor(DarkGray, Black); SetXY(0,0); cout &lt;&lt; \"0\" &lt;&lt;endl;<\/code><\/pre>\n<p>\u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0432\u0435\u0441\u044c \u0432\u044b\u0432\u043e\u0434 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0432\u0435\u0442 \u0442\u0435\u043a\u0441\u0442\u0430 \u0438 \u0444\u043e\u043d\u0430, \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a\u0443\u0440\u0441\u043e\u0440\u0430 \u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <strong>cout<\/strong> \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0430\u0434\u043e. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c <strong>SetColor <\/strong>\u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0432\u0441\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u044b\u0432\u043e\u0434\u044b, \u0438 \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u0447\u0435\u043a \u0438\u043b\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u043e\u0434\u043d\u043e\u0433\u043e \u0446\u0432\u0435\u0442\u0430 \u043f\u043e\u0434\u0440\u044f\u0434, \u0442\u043e <strong>SetColor <\/strong>\u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0432\u044b\u0432\u043e\u0434\u0435. <\/p>\n<pre><code class=\"cpp\">  SetColor(Green, Black); SetXY(0,0); cout &lt;&lt; \"00000\" &lt;&lt;endl;   SetXY(1,1); cout &lt;&lt; \"11111\" &lt;&lt;endl;<\/code><\/pre>\n<p>\u041c\u044b \u0432\u044b\u0432\u0435\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0446\u0438\u0444\u0440 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0445 \u0441\u0442\u0435\u0440\u0435\u0442\u044c. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438.<\/p>\n<p>1) \u041c\u043e\u0436\u043d\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0447\u0442\u043e-\u0442\u043e \u0434\u0440\u0443\u0433\u043e\u0435 \u043d\u0430 \u0442\u0435 \u0436\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b. \u041d\u043e \u044d\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u0435\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043a\u043e\u0433\u0434\u0430 \u0434\u043b\u0438\u043d\u0430 \u043d\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043b\u0438\u0431\u043e \u0440\u0430\u0432\u043d\u0430 \u043b\u0438\u0431\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439. \u0415\u0441\u043b\u0438 \u043d\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u0440\u043e\u0447\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 \u043c\u0435\u0441\u0442\u043e &#171;<strong>CARROT<\/strong>&#187; \u0432\u044b\u0432\u0435\u0441\u0442\u0438 &#171;<strong>apple<\/strong>&#171;, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0443\u044e \u0434\u043b\u0438\u043d\u0443, &#171;<strong>appleT<\/strong>&#171;. \u041c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u0435\u043b, \u0435\u0441\u043b\u0438 \u0434\u043b\u0438\u043d\u0430 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u0438 \u043d\u0435 \u043f\u043e\u043c\u0435\u0448\u0430\u0435\u0442 \u0432\u0430\u043c \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c. \u041d\u0430 \u043c\u0435\u0441\u0442\u043e &#171;<strong>CARROT<\/strong>&#187; \u0432\u044b\u0432\u043e\u0434\u0438\u043c &#171;<strong>apple <\/strong>&#187; \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c &#171;<strong>apple <\/strong>&#171;. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0438\u043c\u0432\u043e\u043b \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0431\u0435\u043b, \u0438 \u0435\u0441\u043b\u0438 <strong>background <\/strong>\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0442\u0430\u043a\u043e\u0439 \u0436\u0435, \u0442\u043e \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u043a \u043a\u0430\u043a \u0431\u044b &#171;\u043f\u0443\u0441\u0442\u043e\u0442\u0430&#187;. <\/p>\n<p>2) <strong>ANSI Escape-\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/strong> &#8212; \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0442\u0435\u043a\u0441\u0442\u0430 \u0438 \u043a\u0443\u0440\u0441\u043e\u0440\u043e\u043c \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430\u0445 \u0438 \u043a\u043e\u043d\u0441\u043e\u043b\u044f\u0445. \u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c &#171;<strong>cout &lt;&lt; &#171;\\x1B[2K\\r&#187;<\/strong>&#171;. \u0417\u0434\u0435\u0441\u044c <strong>\\x1B<\/strong> &#8212; \u044d\u0442\u043e \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 ESC, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f ANSI Escape-\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044f\u043c\u0438, <strong>2K<\/strong> &#8212; \u044d\u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0434\u043b\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0432\u0441\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u0430 <strong>\\r<\/strong> &#8212; \u043f\u0435\u0440\u0435\u043d\u043e\u0441 \u043a\u0443\u0440\u0441\u043e\u0440\u0430 \u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u0441\u0442\u0440\u043e\u043a\u0438. \u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u044d\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 Unix-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 (Linux, macOS), \u043d\u043e \u043d\u0430 Windows \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a.<\/p>\n<p>3) \u041f\u043e\u043b\u043d\u0430\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0433\u0434\u0430 \u0443\u0433\u043e\u0434\u043d\u043e, \u0432 \u043c\u043e\u0435\u043c \u0436\u0435 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u0438\u0437 \u043c\u0435\u043d\u044e \u0432 \u0438\u0433\u0440\u0443 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e.<\/p>\n<pre><code class=\"cpp\">... void clearScreen() {     system(\"cls\"); } ... int main(){ ... clearScreen(); ... }<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u0435\u0437\u0443\u043f\u0440\u0435\u0447\u043d\u043e, \u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 &#171;<strong>system(&#171;cls&#187;)<\/strong>&#187; \u043c\u043e\u0436\u0435\u0442 \u0441\u0447\u0438\u0442\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0441\u0430\u043c\u044b\u043c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u044d\u043a\u0440\u0430\u043d\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0432\u043b\u0435\u0447\u044c \u0437\u0430 \u0441\u043e\u0431\u043e\u0439 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u044b \u0438\u043b\u0438 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438. \u0422\u0430\u043a \u0436\u0435 \u0432\u0430\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u043c \u043e\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 \u0432\u0441\u0435\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445.<\/p>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e  &#171;<strong>system(&#171;cls&#187;)<\/strong>&#187; \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c &#171;<strong>cout &lt;&lt; &#171;\\x1B[2J&#187;<\/strong>&#171;, \u0447\u0435\u043c \u044f \u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u0440\u0435\u0448\u0438\u043b \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 <strong>ANSI Escape-\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439<\/strong>.<\/p>\n<p> \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b  \u0444\u0443\u043d\u043a\u0446\u0438\u044e <strong>void<\/strong>, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u043d\u0435 \u0442\u0430\u043a \u0443\u0434\u043e\u0431\u043d\u0435\u0439, \u043d\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e &#171;<strong>system(&#171;cls&#187;)<\/strong>&#187; \u0438\u043b\u0438 &#171;<strong>cout &lt;&lt; &#171;\\x1B[2J&#187;<\/strong>&#187; \u043f\u0440\u044f\u043c\u043e \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <strong>main() <\/strong>\u0438\u043b\u0438 \u043b\u044e\u0431\u043e\u043c \u0434\u0440\u0443\u0433\u043e\u043c \u043c\u0435\u0441\u0442\u0435.<\/p>\n<h2>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043d\u0430\u0436\u0430\u0442\u0438\u0439 \u043d\u0430 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0443 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438  <\/h2>\n<pre><code class=\"cpp\">int main() {     int key;          while (true) {         if (_kbhit()) { \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0431\u044b\u043b\u0430 \u043b\u0438 \u043d\u0430\u0436\u0430\u0442\u0430 \u043a\u043b\u0430\u0432\u0438\u0448\u0430             key = _getch(); \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0436\u0430\u0442\u0443\u044e \u043a\u043b\u0430\u0432\u0438\u0448\u0443             cout &lt;&lt; \"\u041d\u0430\u0436\u0430\u0442\u0430 \u043a\u043b\u0430\u0432\u0438\u0448\u0430: \" &lt;&lt; key &lt;&lt; endl;                          if (key == 27) { \/\/ 27 - ASCII-\u043a\u043e\u0434 \u043a\u043b\u0430\u0432\u0438\u0448\u0438 \"Esc\"                 break; \/\/ \u0412\u044b\u0445\u043e\u0434 \u0438\u0437 \u0446\u0438\u043a\u043b\u0430 \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043a\u043b\u0430\u0432\u0438\u0448\u0438 \"Esc\"             }         }     } }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043d\u0430\u0436\u0430\u0442\u043e\u0439 \u043a\u043b\u0430\u0432\u0438\u0448\u0435 \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e &#171;<strong>key<\/strong>&#171;.<\/p>\n<p>\u0426\u0438\u043a\u043b &#171;<strong>while(true)<\/strong>&#187; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430. \u041a\u043e\u0433\u0434\u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0432 \u0441\u043a\u043e\u0431\u043a\u0430\u0445 \u0440\u0430\u0432\u043d\u043e <strong>true<\/strong>, \u0446\u0438\u043a\u043b \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0440\u0432\u0430\u043d \u0432\u043d\u0443\u0442\u0440\u0438 \u0446\u0438\u043a\u043b\u0430. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e\u0433\u043e \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u0436\u0430\u0442\u044b\u0445 \u043a\u043b\u0430\u0432\u0438\u0448. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u0436\u0438\u0434\u0430\u0442\u044c \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043b\u0430\u0432\u0438\u0448\u0438 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0435\u0435 \u043a\u043e\u0434 <strong>ASCII<\/strong> \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c. \u0415\u0441\u043b\u0438  \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0436\u0430\u0442\u0430 \u043a\u043b\u0430\u0432\u0438\u0448\u0430 &#171;<strong>Esc&#187;<\/strong>, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442 \u0441\u0432\u043e\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 break.<\/p>\n<p>&#171;<strong>_kbhit()<\/strong>&#187; &#8212; \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0431\u044b\u043b\u0430 \u043b\u0438 \u043d\u0430\u0436\u0430\u0442\u0430 \u043a\u0430\u043a\u0430\u044f-\u043b\u0438\u0431\u043e \u043a\u043b\u0430\u0432\u0438\u0448\u0430 \u043d\u0430 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0435. \u041e\u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0435\u043d\u0443\u043b\u0435\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u043d\u0430\u0436\u0430\u0442\u043e\u0439 \u043a\u043b\u0430\u0432\u0438\u0448\u0438, \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043e\u0442\u043b\u0438\u0447\u043d\u043e\u0435 \u043e\u0442 \u043d\u0443\u043b\u044f (\u043e\u0431\u044b\u0447\u043d\u043e 1) \u0435\u0441\u043b\u0438 \u043a\u043b\u0430\u0432\u0438\u0448\u0430 \u0431\u044b\u043b\u0430 \u043d\u0430\u0436\u0430\u0442\u0430.<\/p>\n<p>&#171;<strong>_getch()<\/strong>&#187; &#8212; \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0431\u0435\u0437 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043b\u0430\u0432\u0438\u0448\u0438 Enter. \u041e\u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <strong>ASCII-\u043a\u043e\u0434<\/strong> \u0441\u0438\u043c\u0432\u043e\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u043d\u0430\u0436\u0430\u0442 \u043d\u0430 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0435. \u041e\u0431\u044b\u0447\u043d\u043e \u0435\u0451 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043f\u043e\u0441\u043b\u0435 &#171;<strong>_kbhit()&#187;,<\/strong> \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u043d\u0430\u0436\u0430\u0442.<\/p>\n<p>\u0412 \u043c\u043e\u0435\u043c \u0436\u0435 \u043a\u043e\u0434\u0435 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">int main() { ...     while (true) {          ...          while (key != 's' &amp;&amp; key != 'S' &amp;&amp; key != 27) { \/\/ \u0416\u0434\u0435\u043c \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \"S\" \u0438\u043b\u0438 \"Esc\"                 if (_kbhit()) {                     key = _getch();                     clearScreen();                 }             }             if (key == 27) { \/\/ \u0415\u0441\u043b\u0438 \"Esc\" \u0431\u044b\u043b\u0430 \u043d\u0430\u0436\u0430\u0442\u0430, \u0432\u044b\u0445\u043e\u0434 \u0438\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b                 break;             }     } }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c, \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0446\u0438\u043a\u043b <strong>while<\/strong> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043a\u0430\u043a\u0430\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u043a\u043b\u0430\u0432\u0438\u0448\u0430 \u0431\u044b\u043b\u0430 \u043d\u0430\u0436\u0430\u0442\u0430, \u0438 \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 &#171;<strong>S<\/strong>&#171;, \u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0435\u0439 &#171;<strong>Start&#187;<\/strong>, \u043e\u0447\u0438\u0449\u0430\u0435\u0442\u0441\u044f \u044d\u043a\u0440\u0430\u043d \u0438 \u0446\u0438\u043a\u043b \u0438\u0433\u0440\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u043d\u043e\u0432\u043e, \u0430 \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 &#171;<strong>Esc<\/strong>&#187; \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0435\u0442 \u0446\u0438\u043a\u043b, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0437\u0430\u043a\u0440\u044b\u0442\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443.<\/p>\n<h2>\u0412\u044b\u0431\u043e\u0440 \u0442\u0435\u043c\u044b<\/h2>\n<pre><code class=\"cpp\">#include &lt;ctime> ... vector &lt;int> wordsKey = {1, 2 ,3 ,4 ,5 }; vector &lt;string> wordsA = {...}; ... while (!(key == 'a' || key == 'A' ...)) {         if (_kbhit()) {             key = _getch();             if (key == 'r' || key == 'R') {                 key = wordsKey[rand() % wordsKey.size()];                 break;             }         }     } ... void ChooseWord(){         if (key == 'a' || key == 'A' || key == 1){         word = wordsA[rand() % wordsA.size()];     }     ...   } ... int main(){   srand(time(NULL));   ... }<\/code><\/pre>\n<p>\u0412 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0442\u0435\u043c \u043f\u044f\u0442\u044c, \u0438 \u0446\u0438\u043a\u043b \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043a\u043b\u0430\u0432\u0438\u0448. \u041f\u043b\u044e\u0441\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0443\u044e \u0442\u0435\u043c\u0443 \u043d\u0430\u0436\u0430\u0442\u0438\u0435\u043c  \u043d\u0430 &#171;<strong>R<\/strong>&#187;  &#8212; &#171;<strong>key = wordsKey[rand() % wordsKey.size()]<\/strong>&#187; \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f key \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u044f\u0442\u044c\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u043c\u0443 \u0447\u0438\u0441\u043b\u0443 \u0438\u0437 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 &#171;<strong>wordsKey<\/strong>&#171;.<\/p>\n<p>\u0421\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0432\u044b\u0431\u043e\u0440 \u0431\u044b\u043b \u0441\u0434\u0435\u043b\u0430\u043d \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e &#171;<strong>srand(time(NULL))<\/strong>&#187; &#8212; \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043f\u0441\u0435\u0432\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b. &#171;<strong>time(NULL)<\/strong>&#187; \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445. \u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 &#171;<strong>time(NULL)<\/strong>&#187; \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f &#171;<strong>srand<\/strong>&#171;, \u043c\u044b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043f\u0441\u0435\u0432\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u043d\u043e\u0432\u044b\u043c \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. <\/p>\n<p>&#171;<strong>word = wordsA[rand() % wordsA.size()]<\/strong>&#171;. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u043c\u044b \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432\u0435\u043a\u0442\u043e\u0440\u0430,<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-369246","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/369246","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=369246"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/369246\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=369246"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=369246"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=369246"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}