五子棋!
#include <iostream>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
using namespace std;
const int N = 15;
const char ChessBoard = ' ';
const char flag1 = 'o';
const char flag2 = 'x';
typedef struct Position{
int row;
int col;
}Position;
class GoBang
{
public:
GoBang(){
InitChessBoard();
}
void Play(){
Position Play1;
Position Play2;
while(1){
while (1) {
PlayChess(Play1, 1, flag1);
if (GetVictory(Play1, 1, flag1)){
break;
}
PlayChess(Play2, 2, flag2);
if (GetVictory(Play2, 2, flag2)){
break;
}
}
cout << "======再来一局=======" << endl;
cout << "yes or no :";
char s[] = "yes";
cin >> s;
if (strcmp(s, "no") == 0){
break;
}
}
}
protected:
void InitChessBoard(){
for (int i = 0; i < N + 1; ++i){
for (int j = 0; j < N + 1; ++j){
_ChessBoard[i][j] = ChessBoard;
}
}
}
void PrintChessBoard(