【C++】 C++游戏设计---五子棋小游戏

ops/2024/11/14 12:33:42/
class="tags" href="/C.html" title=c>cle class="tags" href="/C.html" title=c>class="baidu_pl">
class="tags" href="/C.html" title=c>cle_class="tags" href="/C.html" title=c>content" class="tags" href="/C.html" title=c>class="articlass="tags" href="/C.html" title=c>cle_class="tags" href="/C.html" title=c>content class="tags" href="/C.html" title=c>clearfix">
class="tags" href="/C.html" title=c>content_views" class="tags" href="/C.html" title=c>class="markdown_views prism-atom-one-light">class="tags" href="/C.html" title=c>cap="round" d="M5,0 0,2.5 5,5z" id="raphael-marker-bloclass="tags" href="/C.html" title=c>ck" style="-webkit-tap-highlight-class="tags" href="/C.html" title=c>color: rgba(0, 0, 0, 0);">

1. 游戏介绍

一个简单的 C++ 五子棋小游戏

1.1 游戏规则:
  • 双人轮流输入下入点坐标
  • 横竖撇捺先成五子连线者胜
  • 同一坐标点不允许重复输入
1.2 初始化与游戏界面
  • 初始化界面
  • class="tags" href="/C.html" title=c>c="https://i-blog.class="tags" href="/C.html" title=c>csdnimg.class="tags" href="/C.html" title=c>cn/direclass="tags" href="/C.html" title=c>ct/6aa12496686441f3920class="tags" href="/C.html" title=c>ca9f87e549ab4.png" alt="在这里插入图片描述" />
  • X 输入坐标后
  • class="tags" href="/C.html" title=c>c="https://i-blog.class="tags" href="/C.html" title=c>csdnimg.class="tags" href="/C.html" title=c>cn/direclass="tags" href="/C.html" title=c>ct/2521932e75f34bclass="tags" href="/C.html" title=c>c7a008ea70f9d05aa4.png" alt="在这里插入图片描述" />
  • O 输入坐标后
  • class="tags" href="/C.html" title=c>c="https://i-blog.class="tags" href="/C.html" title=c>csdnimg.class="tags" href="/C.html" title=c>cn/direclass="tags" href="/C.html" title=c>ct/ad5class="tags" href="/C.html" title=c>c93de20ff430480845369753289d5.png" alt="在这里插入图片描述" />
  • X 先达到胜出条件

class="tags" href="/C.html" title=c>c="https://i-blog.class="tags" href="/C.html" title=c>csdnimg.class="tags" href="/C.html" title=c>cn/direclass="tags" href="/C.html" title=c>ct/class="tags" href="/C.html" title=c>cef597class="tags" href="/C.html" title=c>cb7b0b47f5b7670070680b765d.png" alt="在这里插入图片描述" />

2. 源代码

<class="tags" href="/C.html" title=c>code class="tags" href="/C.html" title=c>class="prism language-class="tags" href="/C.html" title=c>cpp">class="tags" href="/C.html" title=c>class="token maclass="tags" href="/C.html" title=c>cro property">class="tags" href="/C.html" title=c>class="token direclass="tags" href="/C.html" title=c>ctive-hash">#class="tags" href="/C.html" title=c>class="token direclass="tags" href="/C.html" title=c>ctive keyword">inclass="tags" href="/C.html" title=c>clude class="tags" href="/C.html" title=c>class="token string"><iostream>
class="tags" href="/C.html" title=c>class="token maclass="tags" href="/C.html" title=c>cro property">class="tags" href="/C.html" title=c>class="token direclass="tags" href="/C.html" title=c>ctive-hash">#class="tags" href="/C.html" title=c>class="token direclass="tags" href="/C.html" title=c>ctive keyword">inclass="tags" href="/C.html" title=c>clude class="tags" href="/C.html" title=c>class="token string"><veclass="tags" href="/C.html" title=c>ctor>
class="tags" href="/C.html" title=c>class="token maclass="tags" href="/C.html" title=c>cro property">class="tags" href="/C.html" title=c>class="token direclass="tags" href="/C.html" title=c>ctive-hash">#class="tags" href="/C.html" title=c>class="token direclass="tags" href="/C.html" title=c>ctive keyword">inclass="tags" href="/C.html" title=c>clude class="tags" href="/C.html" title=c>class="token string"><algorithm>
class="tags" href="/C.html" title=c>class="token maclass="tags" href="/C.html" title=c>cro property">class="tags" href="/C.html" title=c>class="token direclass="tags" href="/C.html" title=c>ctive-hash">#class="tags" href="/C.html" title=c>class="token direclass="tags" href="/C.html" title=c>ctive keyword">inclass="tags" href="/C.html" title=c>clude class="tags" href="/C.html" title=c>class="token string"><limits>class="tags" href="/C.html" title=c>class="token keyword">using class="tags" href="/C.html" title=c>class="token keyword">namespaclass="tags" href="/C.html" title=c>ce stdclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">class="tags" href="/C.html" title=c>const class="tags" href="/C.html" title=c>class="token keyword">int BOARD_SIZE class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">15class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;
class="tags" href="/C.html" title=c>class="token keyword">class="tags" href="/C.html" title=c>char boardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[BOARD_SIZEclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[BOARD_SIZEclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">void class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">initBoardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">for class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int i class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; i class="tags" href="/C.html" title=c>class="token operator">< BOARD_SIZEclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; class="tags" href="/C.html" title=c>class="token operator">++iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">for class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int j class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; j class="tags" href="/C.html" title=c>class="token operator">< BOARD_SIZEclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; class="tags" href="/C.html" title=c>class="token operator">++jclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{boardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[jclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">] class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token string">'.'class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}
class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token keyword">void class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">printBoardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">for class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int i class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; i class="tags" href="/C.html" title=c>class="token operator">< BOARD_SIZEclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; class="tags" href="/C.html" title=c>class="token operator">++iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">for class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int j class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; j class="tags" href="/C.html" title=c>class="token operator">< BOARD_SIZEclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; class="tags" href="/C.html" title=c>class="token operator">++jclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>cout class="tags" href="/C.html" title=c>class="token operator"><< boardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[jclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">] class="tags" href="/C.html" title=c>class="token operator"><< class="tags" href="/C.html" title=c>class="token string">" "class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>cout class="tags" href="/C.html" title=c>class="token operator"><< endlclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}
class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token keyword">bool class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">isBoardFullclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">for class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int i class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; i class="tags" href="/C.html" title=c>class="token operator">< BOARD_SIZEclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; class="tags" href="/C.html" title=c>class="token operator">++iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">for class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int j class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; j class="tags" href="/C.html" title=c>class="token operator">< BOARD_SIZEclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; class="tags" href="/C.html" title=c>class="token operator">++jclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(boardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[jclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">] class="tags" href="/C.html" title=c>class="token operator">== class="tags" href="/C.html" title=c>class="token string">'.'class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">return class="tags" href="/C.html" title=c>class="token boolean">falseclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token keyword">return class="tags" href="/C.html" title=c>class="token boolean">trueclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;
class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token keyword">bool class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckWinclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token keyword">int yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token keyword">class="tags" href="/C.html" title=c>char playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">int class="tags" href="/C.html" title=c>countclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token class="tags" href="/C.html" title=c>comment">// 横向检查class="tags" href="/C.html" title=c>count class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">for class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int i class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">maxclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, x class="tags" href="/C.html" title=c>class="token operator">- class="tags" href="/C.html" title=c>class="token number">4class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; i class="tags" href="/C.html" title=c>class="token operator"><= xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; class="tags" href="/C.html" title=c>class="token operator">++iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(boardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">] class="tags" href="/C.html" title=c>class="token operator">== playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>countclass="tags" href="/C.html" title=c>class="token operator">++class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">} class="tags" href="/C.html" title=c>class="token keyword">else class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>count class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token keyword">for class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int i class="tags" href="/C.html" title=c>class="token operator">= x class="tags" href="/C.html" title=c>class="token operator">+ class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; i class="tags" href="/C.html" title=c>class="token operator">< class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">minclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(BOARD_SIZEclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, x class="tags" href="/C.html" title=c>class="token operator">+ class="tags" href="/C.html" title=c>class="token number">5class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; class="tags" href="/C.html" title=c>class="token operator">++iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(boardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">] class="tags" href="/C.html" title=c>class="token operator">== playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>countclass="tags" href="/C.html" title=c>class="token operator">++class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">} class="tags" href="/C.html" title=c>class="token keyword">else class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">breakclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>count class="tags" href="/C.html" title=c>class="token operator">>= class="tags" href="/C.html" title=c>class="token number">5class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token keyword">return class="tags" href="/C.html" title=c>class="token boolean">trueclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token class="tags" href="/C.html" title=c>comment">// 纵向检查class="tags" href="/C.html" title=c>count class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">for class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int i class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">maxclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, y class="tags" href="/C.html" title=c>class="token operator">- class="tags" href="/C.html" title=c>class="token number">4class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; i class="tags" href="/C.html" title=c>class="token operator"><= yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; class="tags" href="/C.html" title=c>class="token operator">++iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(boardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">] class="tags" href="/C.html" title=c>class="token operator">== playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>countclass="tags" href="/C.html" title=c>class="token operator">++class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">} class="tags" href="/C.html" title=c>class="token keyword">else class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>count class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token keyword">for class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int i class="tags" href="/C.html" title=c>class="token operator">= y class="tags" href="/C.html" title=c>class="token operator">+ class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; i class="tags" href="/C.html" title=c>class="token operator">< class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">minclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(BOARD_SIZEclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, y class="tags" href="/C.html" title=c>class="token operator">+ class="tags" href="/C.html" title=c>class="token number">5class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; class="tags" href="/C.html" title=c>class="token operator">++iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(boardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">] class="tags" href="/C.html" title=c>class="token operator">== playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>countclass="tags" href="/C.html" title=c>class="token operator">++class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">} class="tags" href="/C.html" title=c>class="token keyword">else class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">breakclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>count class="tags" href="/C.html" title=c>class="token operator">>= class="tags" href="/C.html" title=c>class="token number">5class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token keyword">return class="tags" href="/C.html" title=c>class="token boolean">trueclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token class="tags" href="/C.html" title=c>comment">// 斜向(从左上到右下)检查class="tags" href="/C.html" title=c>count class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">for class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int i class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">maxclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token operator">-class="tags" href="/C.html" title=c>class="token number">4class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token operator">-xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; i class="tags" href="/C.html" title=c>class="token operator"><= class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; class="tags" href="/C.html" title=c>class="token operator">++iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(x class="tags" href="/C.html" title=c>class="token operator">+ i class="tags" href="/C.html" title=c>class="token operator">>= class="tags" href="/C.html" title=c>class="token number">0 class="tags" href="/C.html" title=c>class="token operator">&& x class="tags" href="/C.html" title=c>class="token operator">+ i class="tags" href="/C.html" title=c>class="token operator">< BOARD_SIZE class="tags" href="/C.html" title=c>class="token operator">&& y class="tags" href="/C.html" title=c>class="token operator">+ i class="tags" href="/C.html" title=c>class="token operator">>= class="tags" href="/C.html" title=c>class="token number">0 class="tags" href="/C.html" title=c>class="token operator">&& y class="tags" href="/C.html" title=c>class="token operator">+ i class="tags" href="/C.html" title=c>class="token operator">< BOARD_SIZE class="tags" href="/C.html" title=c>class="token operator">&& boardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[y class="tags" href="/C.html" title=c>class="token operator">+ iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[x class="tags" href="/C.html" title=c>class="token operator">+ iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">] class="tags" href="/C.html" title=c>class="token operator">== playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>countclass="tags" href="/C.html" title=c>class="token operator">++class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">} class="tags" href="/C.html" title=c>class="token keyword">else class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>count class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token keyword">for class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int i class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; i class="tags" href="/C.html" title=c>class="token operator"><= class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">minclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token number">4class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, BOARD_SIZE class="tags" href="/C.html" title=c>class="token operator">- class="tags" href="/C.html" title=c>class="token number">1 class="tags" href="/C.html" title=c>class="token operator">- xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; class="tags" href="/C.html" title=c>class="token operator">++iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(x class="tags" href="/C.html" title=c>class="token operator">+ i class="tags" href="/C.html" title=c>class="token operator">>= class="tags" href="/C.html" title=c>class="token number">0 class="tags" href="/C.html" title=c>class="token operator">&& x class="tags" href="/C.html" title=c>class="token operator">+ i class="tags" href="/C.html" title=c>class="token operator">< BOARD_SIZE class="tags" href="/C.html" title=c>class="token operator">&& y class="tags" href="/C.html" title=c>class="token operator">+ i class="tags" href="/C.html" title=c>class="token operator">>= class="tags" href="/C.html" title=c>class="token number">0 class="tags" href="/C.html" title=c>class="token operator">&& y class="tags" href="/C.html" title=c>class="token operator">+ i class="tags" href="/C.html" title=c>class="token operator">< BOARD_SIZE class="tags" href="/C.html" title=c>class="token operator">&& boardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[y class="tags" href="/C.html" title=c>class="token operator">+ iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[x class="tags" href="/C.html" title=c>class="token operator">+ iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">] class="tags" href="/C.html" title=c>class="token operator">== playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>countclass="tags" href="/C.html" title=c>class="token operator">++class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">} class="tags" href="/C.html" title=c>class="token keyword">else class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">breakclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>count class="tags" href="/C.html" title=c>class="token operator">>= class="tags" href="/C.html" title=c>class="token number">5class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token keyword">return class="tags" href="/C.html" title=c>class="token boolean">trueclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token class="tags" href="/C.html" title=c>comment">// 斜向(从右上到左下)检查class="tags" href="/C.html" title=c>count class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">for class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int i class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">maxclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token operator">-class="tags" href="/C.html" title=c>class="token number">4class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token operator">-xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; i class="tags" href="/C.html" title=c>class="token operator"><= class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; class="tags" href="/C.html" title=c>class="token operator">++iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(x class="tags" href="/C.html" title=c>class="token operator">+ i class="tags" href="/C.html" title=c>class="token operator">>= class="tags" href="/C.html" title=c>class="token number">0 class="tags" href="/C.html" title=c>class="token operator">&& x class="tags" href="/C.html" title=c>class="token operator">+ i class="tags" href="/C.html" title=c>class="token operator">< BOARD_SIZE class="tags" href="/C.html" title=c>class="token operator">&& y class="tags" href="/C.html" title=c>class="token operator">- i class="tags" href="/C.html" title=c>class="token operator">>= class="tags" href="/C.html" title=c>class="token number">0 class="tags" href="/C.html" title=c>class="token operator">&& y class="tags" href="/C.html" title=c>class="token operator">- i class="tags" href="/C.html" title=c>class="token operator">< BOARD_SIZE class="tags" href="/C.html" title=c>class="token operator">&& boardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[y class="tags" href="/C.html" title=c>class="token operator">- iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[x class="tags" href="/C.html" title=c>class="token operator">+ iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">] class="tags" href="/C.html" title=c>class="token operator">== playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>countclass="tags" href="/C.html" title=c>class="token operator">++class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">} class="tags" href="/C.html" title=c>class="token keyword">else class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>count class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token keyword">for class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int i class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; i class="tags" href="/C.html" title=c>class="token operator"><= class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">minclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token number">4class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, BOARD_SIZE class="tags" href="/C.html" title=c>class="token operator">- class="tags" href="/C.html" title=c>class="token number">1 class="tags" href="/C.html" title=c>class="token operator">- xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; class="tags" href="/C.html" title=c>class="token operator">++iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(x class="tags" href="/C.html" title=c>class="token operator">+ i class="tags" href="/C.html" title=c>class="token operator">>= class="tags" href="/C.html" title=c>class="token number">0 class="tags" href="/C.html" title=c>class="token operator">&& x class="tags" href="/C.html" title=c>class="token operator">+ i class="tags" href="/C.html" title=c>class="token operator">< BOARD_SIZE class="tags" href="/C.html" title=c>class="token operator">&& y class="tags" href="/C.html" title=c>class="token operator">- i class="tags" href="/C.html" title=c>class="token operator">>= class="tags" href="/C.html" title=c>class="token number">0 class="tags" href="/C.html" title=c>class="token operator">&& y class="tags" href="/C.html" title=c>class="token operator">- i class="tags" href="/C.html" title=c>class="token operator">< BOARD_SIZE class="tags" href="/C.html" title=c>class="token operator">&& boardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[y class="tags" href="/C.html" title=c>class="token operator">- iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[x class="tags" href="/C.html" title=c>class="token operator">+ iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">] class="tags" href="/C.html" title=c>class="token operator">== playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>countclass="tags" href="/C.html" title=c>class="token operator">++class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">} class="tags" href="/C.html" title=c>class="token keyword">else class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">breakclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>count class="tags" href="/C.html" title=c>class="token operator">>= class="tags" href="/C.html" title=c>class="token number">5class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token keyword">return class="tags" href="/C.html" title=c>class="token boolean">trueclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">return class="tags" href="/C.html" title=c>class="token boolean">falseclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;
class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token keyword">int class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">mainclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">initBoardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">bool isPlayerX class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token boolean">trueclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">bool gameOver class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token boolean">falseclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">while class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token operator">!gameOverclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">printBoardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">int xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>cout class="tags" href="/C.html" title=c>class="token operator"><< class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(isPlayerX class="tags" href="/C.html" title=c>class="token operator">? class="tags" href="/C.html" title=c>class="token string">"Player X" class="tags" href="/C.html" title=c>class="token operator">: class="tags" href="/C.html" title=c>class="token string">"Player O"class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token operator"><< class="tags" href="/C.html" title=c>class="token string">", enter your move (row class="tags" href="/C.html" title=c>column): "class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>cin class="tags" href="/C.html" title=c>class="token operator">>> y class="tags" href="/C.html" title=c>class="token operator">>> xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(x class="tags" href="/C.html" title=c>class="token operator">< class="tags" href="/C.html" title=c>class="token number">0 class="tags" href="/C.html" title=c>class="token operator">|| x class="tags" href="/C.html" title=c>class="token operator">>= BOARD_SIZE class="tags" href="/C.html" title=c>class="token operator">|| y class="tags" href="/C.html" title=c>class="token operator">< class="tags" href="/C.html" title=c>class="token number">0 class="tags" href="/C.html" title=c>class="token operator">|| y class="tags" href="/C.html" title=c>class="token operator">>= BOARD_SIZE class="tags" href="/C.html" title=c>class="token operator">|| boardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">] class="tags" href="/C.html" title=c>class="token operator">!= class="tags" href="/C.html" title=c>class="token string">'.'class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>cout class="tags" href="/C.html" title=c>class="token operator"><< class="tags" href="/C.html" title=c>class="token string">"Invalid move. Try again." class="tags" href="/C.html" title=c>class="token operator"><< endlclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">class="tags" href="/C.html" title=c>continueclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}boardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">] class="tags" href="/C.html" title=c>class="token operator">= isPlayerX class="tags" href="/C.html" title=c>class="token operator">? class="tags" href="/C.html" title=c>class="token string">'X' class="tags" href="/C.html" title=c>class="token operator">: class="tags" href="/C.html" title=c>class="token string">'O'class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckWinclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, boardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">printBoardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>cout class="tags" href="/C.html" title=c>class="token operator"><< class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(isPlayerX class="tags" href="/C.html" title=c>class="token operator">? class="tags" href="/C.html" title=c>class="token string">"Player X wins!" class="tags" href="/C.html" title=c>class="token operator">: class="tags" href="/C.html" title=c>class="token string">"Player O wins!"class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token operator"><< endlclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;gameOver class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token boolean">trueclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">} class="tags" href="/C.html" title=c>class="token keyword">else class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">isBoardFullclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">printBoardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>cout class="tags" href="/C.html" title=c>class="token operator"><< class="tags" href="/C.html" title=c>class="token string">"It's a draw!" class="tags" href="/C.html" title=c>class="token operator"><< endlclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;gameOver class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token boolean">trueclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">} class="tags" href="/C.html" title=c>class="token keyword">else class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{isPlayerX class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token operator">!isPlayerXclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token keyword">return class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;
class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>code>

3. 主要代码释解

这段代码是一个简单的五子棋游戏的实现࿰class="tags" href="/C.html" title=c>c;下面是对主要函数和异常错误处理机制的详解:

  1. <class="tags" href="/C.html" title=c>code>initBoard()class="tags" href="/C.html" title=c>code>
    • 功能:初始化棋盘࿰class="tags" href="/C.html" title=c>c;将所有位置设置为’.'࿰class="tags" href="/C.html" title=c>c;表示空白。
    • 实现:通过双重循环遍历二维数组<class="tags" href="/C.html" title=c>code>boardclass="tags" href="/C.html" title=c>code>࿰class="tags" href="/C.html" title=c>c;并将每个元素设置为’.'。
  2. <class="tags" href="/C.html" title=c>code>printBoard()class="tags" href="/C.html" title=c>code>
    • 功能:打印当前棋盘的状态。
    • 实现:通过双重循环遍历二维数组<class="tags" href="/C.html" title=c>code>boardclass="tags" href="/C.html" title=c>code>࿰class="tags" href="/C.html" title=c>c;并打印每个元素。
  3. <class="tags" href="/C.html" title=c>code>isBoardFull()class="tags" href="/C.html" title=c>code>
    • 功能:检查棋盘是否已满。
    • 实现:通过双重循环遍历二维数组<class="tags" href="/C.html" title=c>code>boardclass="tags" href="/C.html" title=c>code>࿰class="tags" href="/C.html" title=c>c;如果所有位置都不是’.'࿰class="tags" href="/C.html" title=c>c;则返回<class="tags" href="/C.html" title=c>code>trueclass="tags" href="/C.html" title=c>code>࿰class="tags" href="/C.html" title=c>c;表示棋盘已满。
  4. <class="tags" href="/C.html" title=c>code>class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckWin(int x, int y, class="tags" href="/C.html" title=c>char player)class="tags" href="/C.html" title=c>code>
    • 功能:检查给定玩家是否在(x, y)位置获胜。
    • 实现:检查横向、纵向、两个对角线方向是否有连续的 5 个相同的棋子。如果找到࿰class="tags" href="/C.html" title=c>c;则返回<class="tags" href="/C.html" title=c>code>trueclass="tags" href="/C.html" title=c>code>࿰class="tags" href="/C.html" title=c>c;表示该玩家获胜。
  5. <class="tags" href="/C.html" title=c>code>main()class="tags" href="/C.html" title=c>code>
    • 功能:游戏的主循环࿰class="tags" href="/C.html" title=c>c;处理玩家的输入࿰class="tags" href="/C.html" title=c>c;更新棋盘状态࿰class="tags" href="/C.html" title=c>c;并判断游戏是否结束。
    • 实现
      • 初始化棋盘。
      • 在一个循环中交替让两个玩家输入他们的移动。
      • 检查移动是否有效(即在棋盘范围内且位置为空)。
      • 更新棋盘࿰class="tags" href="/C.html" title=c>c;并检查是否有玩家获胜或棋盘已满。

4. 异常和错误处理机制

  1. 输入有效性检查
    • 在<class="tags" href="/C.html" title=c>code>main()class="tags" href="/C.html" title=c>code>函数中࿰class="tags" href="/C.html" title=c>c;玩家输入移动后࿰class="tags" href="/C.html" title=c>c;代码检查移动是否在棋盘范围内࿰class="tags" href="/C.html" title=c>c;以及对应位置是否为空。
    • 如果移动无效(即<class="tags" href="/C.html" title=c>code>xclass="tags" href="/C.html" title=c>code>或<class="tags" href="/C.html" title=c>code>yclass="tags" href="/C.html" title=c>code>超出范围࿰class="tags" href="/C.html" title=c>c;或者对应位置不是’.')࿰class="tags" href="/C.html" title=c>c;则打印错误消息࿰class="tags" href="/C.html" title=c>c;并通过<class="tags" href="/C.html" title=c>code>class="tags" href="/C.html" title=c>continueclass="tags" href="/C.html" title=c>code>跳过当前循环的剩余部分࿰class="tags" href="/C.html" title=c>c;提示玩家重新输入。
  2. 棋盘满时结束游戏
    • 在玩家每次移动后࿰class="tags" href="/C.html" title=c>c;调用<class="tags" href="/C.html" title=c>code>isBoardFull()class="tags" href="/C.html" title=c>code>检查棋盘是否已满。
    • 如果棋盘已满࿰class="tags" href="/C.html" title=c>c;则打印平局消息࿰class="tags" href="/C.html" title=c>c;并通过设置<class="tags" href="/C.html" title=c>code>gameOverclass="tags" href="/C.html" title=c>code>为<class="tags" href="/C.html" title=c>code>trueclass="tags" href="/C.html" title=c>code>结束游戏。
  3. 检查获胜条件
    • 在玩家每次移动后࿰class="tags" href="/C.html" title=c>c;调用<class="tags" href="/C.html" title=c>code>class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckWin()class="tags" href="/C.html" title=c>code>检查该玩家是否获胜。
    • 如果玩家获胜࿰class="tags" href="/C.html" title=c>c;则打印获胜消息࿰class="tags" href="/C.html" title=c>c;并通过设置<class="tags" href="/C.html" title=c>code>gameOverclass="tags" href="/C.html" title=c>code>为<class="tags" href="/C.html" title=c>code>trueclass="tags" href="/C.html" title=c>code>结束游戏。

5. 可改进点

  • 异常处理:代码中没有使用 C++ 的异常处理机制࿰class="tags" href="/C.html" title=c>c;例如<class="tags" href="/C.html" title=c>code>try-class="tags" href="/C.html" title=c>catclass="tags" href="/C.html" title=c>chclass="tags" href="/C.html" title=c>code>块。在某些情况下࿰class="tags" href="/C.html" title=c>c;如果输入不是整数࿰class="tags" href="/C.html" title=c>c;<class="tags" href="/C.html" title=c>code>class="tags" href="/C.html" title=c>cinclass="tags" href="/C.html" title=c>code>会进入错误状态࿰class="tags" href="/C.html" title=c>c;这可能导致无限循环。可以通过检查<class="tags" href="/C.html" title=c>code>class="tags" href="/C.html" title=c>cinclass="tags" href="/C.html" title=c>code>的状态并清除错误标志来处理这种情况。
  • 边界条件检查:在<class="tags" href="/C.html" title=c>code>class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckWin()class="tags" href="/C.html" title=c>code>函数中࿰class="tags" href="/C.html" title=c>c;对斜向检查的边界条件处理可以进一步优化࿰class="tags" href="/C.html" title=c>c;以避免不必要的条件判断。
  • 代码重用:<class="tags" href="/C.html" title=c>code>class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckWin()class="tags" href="/C.html" title=c>code>函数中的横向、纵向和斜向检查有大量重复代码࿰class="tags" href="/C.html" title=c>c;可以通过提取重复代码到单独的函数中来简化。

这个游戏实现简单࿰class="tags" href="/C.html" title=c>c;但包含了基本的游戏逻辑和错误处理机制࿰class="tags" href="/C.html" title=c>c;适合作为学习<class="tags" href="/C.html" title=c>code>C++class="tags" href="/C.html" title=c>code>和游戏编程的入门项目。



6. 追更

  • 6.1 优化了判胜代码
<class="tags" href="/C.html" title=c>code class="tags" href="/C.html" title=c>class="prism language-class="tags" href="/C.html" title=c>cpp">class="tags" href="/C.html" title=c>class="token class="tags" href="/C.html" title=c>comment">// 检查给定玩家是否在(x, y)位置沿一个方向获胜
class="tags" href="/C.html" title=c>class="token keyword">bool class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckDireclass="tags" href="/C.html" title=c>ctionclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token keyword">int yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token keyword">int dxclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token keyword">int dyclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token keyword">class="tags" href="/C.html" title=c>char playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">int class="tags" href="/C.html" title=c>count class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">for class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int i class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; i class="tags" href="/C.html" title=c>class="token operator">< class="tags" href="/C.html" title=c>class="token number">5class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; class="tags" href="/C.html" title=c>class="token operator">++iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">int class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckX class="tags" href="/C.html" title=c>class="token operator">= x class="tags" href="/C.html" title=c>class="token operator">+ i class="tags" href="/C.html" title=c>class="token operator">* dxclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">int class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckY class="tags" href="/C.html" title=c>class="token operator">= y class="tags" href="/C.html" title=c>class="token operator">+ i class="tags" href="/C.html" title=c>class="token operator">* dyclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckX class="tags" href="/C.html" title=c>class="token operator">>= class="tags" href="/C.html" title=c>class="token number">0 class="tags" href="/C.html" title=c>class="token operator">&& class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckX class="tags" href="/C.html" title=c>class="token operator">< BOARD_SIZE class="tags" href="/C.html" title=c>class="token operator">&& class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckY class="tags" href="/C.html" title=c>class="token operator">>= class="tags" href="/C.html" title=c>class="token number">0 class="tags" href="/C.html" title=c>class="token operator">&& class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckY class="tags" href="/C.html" title=c>class="token operator">< BOARD_SIZE class="tags" href="/C.html" title=c>class="token operator">&& boardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckYclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckXclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">] class="tags" href="/C.html" title=c>class="token operator">== playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>countclass="tags" href="/C.html" title=c>class="token operator">++class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">} class="tags" href="/C.html" title=c>class="token keyword">else class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">breakclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token keyword">return class="tags" href="/C.html" title=c>count class="tags" href="/C.html" title=c>class="token operator">== class="tags" href="/C.html" title=c>class="token number">5class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;
class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token class="tags" href="/C.html" title=c>comment">// 检查给定玩家是否在(x, y)位置获胜
class="tags" href="/C.html" title=c>class="token keyword">bool class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckWinclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token keyword">int yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token keyword">class="tags" href="/C.html" title=c>char playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token class="tags" href="/C.html" title=c>comment">// 检查水平方向class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckDireclass="tags" href="/C.html" title=c>ctionclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token operator">|| class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckDireclass="tags" href="/C.html" title=c>ctionclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token operator">-class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">return class="tags" href="/C.html" title=c>class="token boolean">trueclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token class="tags" href="/C.html" title=c>comment">// 检查垂直方向class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckDireclass="tags" href="/C.html" title=c>ctionclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token operator">|| class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckDireclass="tags" href="/C.html" title=c>ctionclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token operator">-class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">return class="tags" href="/C.html" title=c>class="token boolean">trueclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token class="tags" href="/C.html" title=c>comment">// 检查两个斜线方向class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckDireclass="tags" href="/C.html" title=c>ctionclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token operator">|| class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckDireclass="tags" href="/C.html" title=c>ctionclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token operator">-class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token operator">-class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">return class="tags" href="/C.html" title=c>class="token boolean">trueclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckDireclass="tags" href="/C.html" title=c>ctionclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token operator">-class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token operator">|| class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckDireclass="tags" href="/C.html" title=c>ctionclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token operator">-class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">return class="tags" href="/C.html" title=c>class="token boolean">trueclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token keyword">return class="tags" href="/C.html" title=c>class="token boolean">falseclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;
class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}
class="tags" href="/C.html" title=c>code>
6.2 完整代码
  • class="tags" href="/C.html" title=c>catclass="tags" href="/C.html" title=c>ch_254">优化了判胜代码并增加了<class="tags" href="/C.html" title=c>code>try-class="tags" href="/C.html" title=c>catclass="tags" href="/C.html" title=c>chclass="tags" href="/C.html" title=c>code>块捕获异常࿰class="tags" href="/C.html" title=c>c;仅供参考
<class="tags" href="/C.html" title=c>code class="tags" href="/C.html" title=c>class="prism language-class="tags" href="/C.html" title=c>cpp">class="tags" href="/C.html" title=c>class="token maclass="tags" href="/C.html" title=c>cro property">class="tags" href="/C.html" title=c>class="token direclass="tags" href="/C.html" title=c>ctive-hash">#class="tags" href="/C.html" title=c>class="token direclass="tags" href="/C.html" title=c>ctive keyword">inclass="tags" href="/C.html" title=c>clude class="tags" href="/C.html" title=c>class="token string"><iostream>
class="tags" href="/C.html" title=c>class="token maclass="tags" href="/C.html" title=c>cro property">class="tags" href="/C.html" title=c>class="token direclass="tags" href="/C.html" title=c>ctive-hash">#class="tags" href="/C.html" title=c>class="token direclass="tags" href="/C.html" title=c>ctive keyword">inclass="tags" href="/C.html" title=c>clude class="tags" href="/C.html" title=c>class="token string"><veclass="tags" href="/C.html" title=c>ctor>
class="tags" href="/C.html" title=c>class="token maclass="tags" href="/C.html" title=c>cro property">class="tags" href="/C.html" title=c>class="token direclass="tags" href="/C.html" title=c>ctive-hash">#class="tags" href="/C.html" title=c>class="token direclass="tags" href="/C.html" title=c>ctive keyword">inclass="tags" href="/C.html" title=c>clude class="tags" href="/C.html" title=c>class="token string"><limits>class="tags" href="/C.html" title=c>class="token keyword">using class="tags" href="/C.html" title=c>class="token keyword">namespaclass="tags" href="/C.html" title=c>ce stdclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">class="tags" href="/C.html" title=c>const class="tags" href="/C.html" title=c>class="token keyword">int BOARD_SIZE class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">15class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;
class="tags" href="/C.html" title=c>class="token keyword">class="tags" href="/C.html" title=c>char boardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[BOARD_SIZEclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[BOARD_SIZEclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token class="tags" href="/C.html" title=c>comment">// 初始化棋盘
class="tags" href="/C.html" title=c>class="token keyword">void class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">initBoardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">for class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int i class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; i class="tags" href="/C.html" title=c>class="token operator">< BOARD_SIZEclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; class="tags" href="/C.html" title=c>class="token operator">++iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">for class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int j class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; j class="tags" href="/C.html" title=c>class="token operator">< BOARD_SIZEclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; class="tags" href="/C.html" title=c>class="token operator">++jclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{boardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[jclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">] class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token string">'.'class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}
class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token class="tags" href="/C.html" title=c>comment">// 打印棋盘
class="tags" href="/C.html" title=c>class="token keyword">void class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">printBoardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">for class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int i class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; i class="tags" href="/C.html" title=c>class="token operator">< BOARD_SIZEclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; class="tags" href="/C.html" title=c>class="token operator">++iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">for class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int j class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; j class="tags" href="/C.html" title=c>class="token operator">< BOARD_SIZEclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; class="tags" href="/C.html" title=c>class="token operator">++jclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>cout class="tags" href="/C.html" title=c>class="token operator"><< boardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[jclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">] class="tags" href="/C.html" title=c>class="token operator"><< class="tags" href="/C.html" title=c>class="token string">" "class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>cout class="tags" href="/C.html" title=c>class="token operator"><< endlclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}
class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token class="tags" href="/C.html" title=c>comment">// 检查棋盘是否已满
class="tags" href="/C.html" title=c>class="token keyword">bool class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">isBoardFullclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">for class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int i class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; i class="tags" href="/C.html" title=c>class="token operator">< BOARD_SIZEclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; class="tags" href="/C.html" title=c>class="token operator">++iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">for class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int j class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; j class="tags" href="/C.html" title=c>class="token operator">< BOARD_SIZEclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; class="tags" href="/C.html" title=c>class="token operator">++jclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(boardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[jclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">] class="tags" href="/C.html" title=c>class="token operator">== class="tags" href="/C.html" title=c>class="token string">'.'class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">return class="tags" href="/C.html" title=c>class="token boolean">falseclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token keyword">return class="tags" href="/C.html" title=c>class="token boolean">trueclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;
class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token class="tags" href="/C.html" title=c>comment">// 检查给定玩家是否在(x, y)位置沿一个方向获胜
class="tags" href="/C.html" title=c>class="token keyword">bool class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckDireclass="tags" href="/C.html" title=c>ctionclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token keyword">int yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token keyword">int dxclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token keyword">int dyclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token keyword">class="tags" href="/C.html" title=c>char playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">int class="tags" href="/C.html" title=c>count class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">for class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int i class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; i class="tags" href="/C.html" title=c>class="token operator">< class="tags" href="/C.html" title=c>class="token number">5class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; class="tags" href="/C.html" title=c>class="token operator">++iclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">int class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckX class="tags" href="/C.html" title=c>class="token operator">= x class="tags" href="/C.html" title=c>class="token operator">+ i class="tags" href="/C.html" title=c>class="token operator">* dxclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">int class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckY class="tags" href="/C.html" title=c>class="token operator">= y class="tags" href="/C.html" title=c>class="token operator">+ i class="tags" href="/C.html" title=c>class="token operator">* dyclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckX class="tags" href="/C.html" title=c>class="token operator">>= class="tags" href="/C.html" title=c>class="token number">0 class="tags" href="/C.html" title=c>class="token operator">&& class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckX class="tags" href="/C.html" title=c>class="token operator">< BOARD_SIZE class="tags" href="/C.html" title=c>class="token operator">&& class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckY class="tags" href="/C.html" title=c>class="token operator">>= class="tags" href="/C.html" title=c>class="token number">0 class="tags" href="/C.html" title=c>class="token operator">&& class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckY class="tags" href="/C.html" title=c>class="token operator">< BOARD_SIZE class="tags" href="/C.html" title=c>class="token operator">&& boardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckYclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckXclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">] class="tags" href="/C.html" title=c>class="token operator">== playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>countclass="tags" href="/C.html" title=c>class="token operator">++class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">} class="tags" href="/C.html" title=c>class="token keyword">else class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">breakclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token keyword">return class="tags" href="/C.html" title=c>count class="tags" href="/C.html" title=c>class="token operator">== class="tags" href="/C.html" title=c>class="token number">5class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;
class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token class="tags" href="/C.html" title=c>comment">// 检查给定玩家是否在(x, y)位置获胜
class="tags" href="/C.html" title=c>class="token keyword">bool class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckWinclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">int xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token keyword">int yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token keyword">class="tags" href="/C.html" title=c>char playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token class="tags" href="/C.html" title=c>comment">// 检查水平方向class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckDireclass="tags" href="/C.html" title=c>ctionclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token operator">|| class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckDireclass="tags" href="/C.html" title=c>ctionclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token operator">-class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">return class="tags" href="/C.html" title=c>class="token boolean">trueclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token class="tags" href="/C.html" title=c>comment">// 检查垂直方向class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckDireclass="tags" href="/C.html" title=c>ctionclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token operator">|| class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckDireclass="tags" href="/C.html" title=c>ctionclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token operator">-class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">return class="tags" href="/C.html" title=c>class="token boolean">trueclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token class="tags" href="/C.html" title=c>comment">// 检查两个斜线方向class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckDireclass="tags" href="/C.html" title=c>ctionclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token operator">|| class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckDireclass="tags" href="/C.html" title=c>ctionclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token operator">-class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token operator">-class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">return class="tags" href="/C.html" title=c>class="token boolean">trueclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckDireclass="tags" href="/C.html" title=c>ctionclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token operator">-class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token operator">|| class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckDireclass="tags" href="/C.html" title=c>ctionclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token operator">-class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token number">1class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, playerclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">return class="tags" href="/C.html" title=c>class="token boolean">trueclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token keyword">return class="tags" href="/C.html" title=c>class="token boolean">falseclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;
class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token keyword">int class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">mainclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">initBoardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">bool isPlayerX class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token boolean">trueclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">bool gameOver class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token boolean">falseclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">while class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token operator">!gameOverclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">printBoardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">int xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>cout class="tags" href="/C.html" title=c>class="token operator"><< class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(isPlayerX class="tags" href="/C.html" title=c>class="token operator">? class="tags" href="/C.html" title=c>class="token string">"Player X" class="tags" href="/C.html" title=c>class="token operator">: class="tags" href="/C.html" title=c>class="token string">"Player O"class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token operator"><< class="tags" href="/C.html" title=c>class="token string">", enter your move (row class="tags" href="/C.html" title=c>column): "class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">try class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>cin class="tags" href="/C.html" title=c>class="token operator">>> y class="tags" href="/C.html" title=c>class="token operator">>> xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>cinclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">.class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">failclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>cinclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">.class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">class="tags" href="/C.html" title=c>clearclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; class="tags" href="/C.html" title=c>class="token class="tags" href="/C.html" title=c>comment">// 清除错误标志class="tags" href="/C.html" title=c>cinclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">.class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">ignoreclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token class="tags" href="/C.html" title=c>class-name">numericlass="tags" href="/C.html" title=c>c_limitsclass="tags" href="/C.html" title=c>class="token operator"><streamsizeclass="tags" href="/C.html" title=c>class="token operator">>class="tags" href="/C.html" title=c>class="token operator">::class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">maxclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, class="tags" href="/C.html" title=c>class="token string">'\n'class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">; class="tags" href="/C.html" title=c>class="token class="tags" href="/C.html" title=c>comment">// 忽略错误输入class="tags" href="/C.html" title=c>class="token keyword">throw class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">runtime_errorclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token string">"Invalid input. Please enter numbers."class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(x class="tags" href="/C.html" title=c>class="token operator">< class="tags" href="/C.html" title=c>class="token number">0 class="tags" href="/C.html" title=c>class="token operator">|| x class="tags" href="/C.html" title=c>class="token operator">>= BOARD_SIZE class="tags" href="/C.html" title=c>class="token operator">|| y class="tags" href="/C.html" title=c>class="token operator">< class="tags" href="/C.html" title=c>class="token number">0 class="tags" href="/C.html" title=c>class="token operator">|| y class="tags" href="/C.html" title=c>class="token operator">>= BOARD_SIZE class="tags" href="/C.html" title=c>class="token operator">|| boardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">] class="tags" href="/C.html" title=c>class="token operator">!= class="tags" href="/C.html" title=c>class="token string">'.'class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token keyword">throw class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">runtime_errorclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token string">"Invalid move. Try again."class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}boardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">] class="tags" href="/C.html" title=c>class="token operator">= isPlayerX class="tags" href="/C.html" title=c>class="token operator">? class="tags" href="/C.html" title=c>class="token string">'X' class="tags" href="/C.html" title=c>class="token operator">: class="tags" href="/C.html" title=c>class="token string">'O'class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">class="tags" href="/C.html" title=c>checlass="tags" href="/C.html" title=c>ckWinclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">, boardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[yclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">[xclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">]class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">printBoardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>cout class="tags" href="/C.html" title=c>class="token operator"><< class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(isPlayerX class="tags" href="/C.html" title=c>class="token operator">? class="tags" href="/C.html" title=c>class="token string">"Player X wins!" class="tags" href="/C.html" title=c>class="token operator">: class="tags" href="/C.html" title=c>class="token string">"Player O wins!"class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token operator"><< endlclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;gameOver class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token boolean">trueclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">} class="tags" href="/C.html" title=c>class="token keyword">else class="tags" href="/C.html" title=c>class="token keyword">if class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">isBoardFullclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">printBoardclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">)class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>cout class="tags" href="/C.html" title=c>class="token operator"><< class="tags" href="/C.html" title=c>class="token string">"It's a draw!" class="tags" href="/C.html" title=c>class="token operator"><< endlclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;gameOver class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token boolean">trueclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">} class="tags" href="/C.html" title=c>class="token keyword">else class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{isPlayerX class="tags" href="/C.html" title=c>class="token operator">= class="tags" href="/C.html" title=c>class="token operator">!isPlayerXclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">} class="tags" href="/C.html" title=c>class="token keyword">class="tags" href="/C.html" title=c>catclass="tags" href="/C.html" title=c>ch class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token keyword">class="tags" href="/C.html" title=c>const runtime_errorclass="tags" href="/C.html" title=c>class="token operator">& eclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">{class="tags" href="/C.html" title=c>cout class="tags" href="/C.html" title=c>class="token operator"><< eclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">.class="tags" href="/C.html" title=c>class="token funclass="tags" href="/C.html" title=c>ction">whatclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">(class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">) class="tags" href="/C.html" title=c>class="token operator"><< endlclass="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;class="tags" href="/C.html" title=c>class="token class="tags" href="/C.html" title=c>comment">// 可以选择在这里处理错误࿰class="tags" href="/C.html" title=c>c;例如跳过当前玩家的回合class="tags" href="/C.html" title=c>class="token class="tags" href="/C.html" title=c>comment">// 或者让玩家重新输入࿰class="tags" href="/C.html" title=c>c;取决于你的游戏规则class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>class="token keyword">return class="tags" href="/C.html" title=c>class="token number">0class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">;
class="tags" href="/C.html" title=c>class="token punclass="tags" href="/C.html" title=c>ctuation">}class="tags" href="/C.html" title=c>code>

在这个修改后的代码中࿰class="tags" href="/C.html" title=c>c;<class="tags" href="/C.html" title=c>code>try-class="tags" href="/C.html" title=c>catclass="tags" href="/C.html" title=c>chclass="tags" href="/C.html" title=c>code>块被用来捕获两种异常情况:

  1. 当<class="tags" href="/C.html" title=c>code>class="tags" href="/C.html" title=c>cinclass="tags" href="/C.html" title=c>code>接收到非数字输入时࿰class="tags" href="/C.html" title=c>c;会进入错误状态。<class="tags" href="/C.html" title=c>code>class="tags" href="/C.html" title=c>cin.fail()class="tags" href="/C.html" title=c>code>检查输入流是否失败࿰class="tags" href="/C.html" title=c>c;如果是࿰class="tags" href="/C.html" title=c>c;则清除错误标志࿰class="tags" href="/C.html" title=c>c;并忽略错误输入直到下一个换行符。然后抛出一个<class="tags" href="/C.html" title=c>code>runtime_errorclass="tags" href="/C.html" title=c>code>异常。
  2. 当用户输入的坐标无效时(即不在棋盘范围内或该位置已被占用)࿰class="tags" href="/C.html" title=c>c;也会抛出一个<class="tags" href="/C.html" title=c>code>runtime_errorclass="tags" href="/C.html" title=c>code>异常。
    在<class="tags" href="/C.html" title=c>code>class="tags" href="/C.html" title=c>catclass="tags" href="/C.html" title=c>chclass="tags" href="/C.html" title=c>code>块中࿰class="tags" href="/C.html" title=c>c;我们捕获了<class="tags" href="/C.html" title=c>code>runtime_errorclass="tags" href="/C.html" title=c>code>异常࿰class="tags" href="/C.html" title=c>c;并打印出异常信息。根据你的游戏规则࿰class="tags" href="/C.html" title=c>c;你可以选择让当前玩家重新输入࿰class="tags" href="/C.html" title=c>c;或者跳过当前玩家的回合࿰class="tags" href="/C.html" title=c>c;或者采取其他适当的错误处理措施。

在这个例子中࿰class="tags" href="/C.html" title=c>c;我们只是打印了错误信息࿰class="tags" href="/C.html" title=c>c;然后循环会继续࿰class="tags" href="/C.html" title=c>c;提示玩家重新输入。


http://www.ppmy.cn/ops/133257.html

相关文章

虚拟机linux7.9下安装mysql

1.MySQL官网下载安装包&#xff1a; MySQL :: Download MySQL Community Server https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.39-linux-glibc2.12-x86_64.tar.gz 2.解压文件&#xff1a; #tar xvzf mysql-5.7.39-linux-glibc2.12-x86_64.tar.gz 3.移动文件&#…

我的博客网站为什么又回归Blazor了

引言 在博客网站的开发征程中&#xff0c;站长可谓是一路披荆斩棘。从最初的构思到实践&#xff0c;先后涉足了多种开发技术&#xff0c;包括 MVC、Razor Pages、Vue、Go、Blazor 等。在这漫长的过程中&#xff0c;网站版本更迭近 10 次&#xff0c;每一个版本都凝聚着站长的心…

什么是网络安全CTF有何意义?该如何入门?

什么是网络安全CTF?有何意义 &#xff1f;该如何入门 &#xff1f; 什么是网络安全CTF? CTF在网络安全领域中指的是网络安全技术人员之间进行技术竞技的一种比赛形式。它起源于1996年DEFCON&#xff0c;以代替之前通过互相发起真实攻击进行技术比拼的方式。发展至今&#xff…

MySQL技巧之跨服务器数据查询:基础篇-更新语句如何写

MySQL技巧之跨服务器数据查询&#xff1a;基础篇-更新语句如何写 上一篇已经描述&#xff1a;借用微软的SQL Server ODBC 即可实现MySQL跨服务器间的数据查询。 而且还介绍了如何获得一个在MS SQL Server 可以连接指定实例的MySQL数据库的连接名: MY_ODBC_MYSQL 以及用同样的…

基于JDBC的书库系统(MySQL)

一、创建数据库中的表 1、需求 有一张表叫javabook【创建表要求使用sql语句进行】 表中列 bookid 整数自增类型 表中列 bprice 小数类型 表中列 bookname 字符串类型 长度不能小于50 工程和包要求&#xff1a; domain dao …

Oracle 聚集因子factor clustering

文章目录 聚集因子(Factor clustering)举例说明查询聚集因子聚集因子的优化结论 最近发现突然忘记聚集因子的原理了&#xff0c;故整理记录一下 聚集因子(Factor clustering) 在Oracle中&#xff0c;聚集因子&#xff08;Clustering Factor&#xff09;用于衡量数据在表中存储…

Linux环境基础开发工具的使用_yum源_vim_Git控制器

目录 本节目标&#xff1a; 一、Linux 软件包管理器 yum 1.什么是软件包 2.关于 rzsz 3.注意事项 4.查看软件包 5.注意事项: 6.如何安装软件 说到这里&#xff0c;就可以取百度上康康有哪些好玩的指令&#xff1a; 二、Linux开发工具 Linux编辑器-vim使用 1. vim的基…

恒流数显驱动数显LED驱动芯片VK16D32

产品品牌&#xff1a;永嘉微电/VINKA 产品型号&#xff1a;VK16D32 封装形式&#xff1a;SSOP24L 概述 VK16D32是一种恒流数码管或点阵LED驱动控制专用芯片&#xff0c;内部集成有数据锁存器、LED 恒流驱动模块等电路。可以通过寄存器配置&#xff0c;调节扫描的位数&#…