题解 | #井字棋#
井字棋
http://www.nowcoder.com/practice/0375c1d206ef48a3894f72aa07b2fdde
buzhi不知道哪里错了
```
```#include <iostream>
using namespace std;</iostream>
int main ()
{
int flag=0;
char arr[3][3];
for (int i=0;i<3;i++) { for (int j=0;j<3;j++) { cin>>arr[i][j]; } } //判断是否交叉 if (arr[1][1]==arr[2][2]==arr[0][0]||arr[1][1]==arr[2][0]==arr[0][2]) if (arr[1][1]=='K') cout<<"KiKi wins!\n"; else cout<<"BoBo wins!\n"; else//当不交叉执行下面 {for (int i=0;i<3;i++)//是否成行,列 { if (arr[i][0]==arr[i][1]==arr[i][2])//cheng hang {if (arr[i][1]=='K') {cout<<"KiKi wins!\n"; flag=1;} else cout<<"BoBo wins!\n"; flag=1; } if (arr[0][i]==arr[1][i]==arr[2][i])//cheng lie {if (arr[1][i]=='K') {cout<<"KiKi wins!\n"; flag=1;} else {cout<<"BoBo wins!\n"; flag=1;} } } if (flag==0) cout<<"No winner!\n"; }
}