井字棋算法 用c++的goto,直接判断斜线和行和列

```#include<bits/stdc++.h>
using namespace std;
char m[3][3];

int main(){
    for(int i = 0; i < 3; i++)
        for(int j = 0; j < 3; j++)
            cin >> m[i][j];
    /*左斜线*/
    if(m[0][0] == m[1][1] && m[0][0] == m[2][2]){
        if(m[0][0] == 'K') goto K;
        else if(m[0][0] == 'B') goto B;
    }
    /*右斜线*/
    if(m[0][2] == m[1][1] && m[0][2] == m[2][0]){
        if(m[0][2] == 'K') goto K;
        else if(m[0][2] == 'B') goto B;
    }
   
    for(int i = 0; i < 3; i++){
         /*行相等*/
        if(m[i][0] == m[i][1] && m[i][0] == m[i][2]){
            if(m[i][0] == 'K') goto K;
            else if(m[i][0] == 'B') goto B;
        }
        /*列相等*/
        if(m[0][i] == m[1][i] && m[0][i] == m[2][i]){
            if(m[0][i] == 'K') goto K;
            else if(m[0][i] == 'B') goto B;
        }
    }
    cout << "No winner!" << endl;
    return 0;
    K:
        cout << "KiKi wins!" << endl;
        return 0;
    B:
        cout << "BoBo wins!" << endl;
        return 0;
}