请教大家井字游戏是什么?小弟我有代码却不知道怎么在VC++。NET中使用运行,多谢
请问大家井字游戏是什么?我有代码却不知道如何在VC++。NET中使用运行,谢谢
#include <iostream>
#include <string>
using namespace std;
typedef char chess[10]; //字符数组
typedef int temparr[10]; //整型数组
chess arr; //定义字符数组变量
temparr brr; //定义整型数组变量
int number,suc,n3,c3,n2,c2,n1,c1;
void inarrdata(chess a) //初始化棋盘编号
{
a[1]= '1 ';a[2]= '2 ';a[3]= '3 ';
a[4]= '4 ';a[5]= '5 ';a[6]= '6 ';
a[7]= '7 ';a[8]= '8 ';a[9]= '9 ';
}
void display(chess a) //输出棋盘状态
{
cout < <endl;cout < <endl;
cout < < " " < <a[1] < < " " < < '| ' < < " " < <a[2] < < " " < < '| ' < < " " < <a[3] < <endl;
cout < < " ----------- " < <endl;
cout < < " " < <a[4] < < " " < < '| ' < < " " < <a[5] < < " " < < '| ' < < " " < <a[6] < <endl;
cout < < " ----------- " < <endl;
cout < < " " < <a[7] < < " " < < '| ' < < " " < <a[8] < < " " < < '| ' < < " " < <a[9] < <endl;
cout < <endl;cout < <endl;
}
int arrfull() //判断还有没有下棋的位置
{
int i;
int arrf=0;
for(i=1;i <=9;i++)
if(i==arr[i]-48) //如果字符arr[i]-48等于i
arrf=1; //那么arrf=1,也就是可以走棋
#include <iostream>
#include <string>
using namespace std;
typedef char chess[10]; //字符数组
typedef int temparr[10]; //整型数组
chess arr; //定义字符数组变量
temparr brr; //定义整型数组变量
int number,suc,n3,c3,n2,c2,n1,c1;
void inarrdata(chess a) //初始化棋盘编号
{
a[1]= '1 ';a[2]= '2 ';a[3]= '3 ';
a[4]= '4 ';a[5]= '5 ';a[6]= '6 ';
a[7]= '7 ';a[8]= '8 ';a[9]= '9 ';
}
void display(chess a) //输出棋盘状态
{
cout < <endl;cout < <endl;
cout < < " " < <a[1] < < " " < < '| ' < < " " < <a[2] < < " " < < '| ' < < " " < <a[3] < <endl;
cout < < " ----------- " < <endl;
cout < < " " < <a[4] < < " " < < '| ' < < " " < <a[5] < < " " < < '| ' < < " " < <a[6] < <endl;
cout < < " ----------- " < <endl;
cout < < " " < <a[7] < < " " < < '| ' < < " " < <a[8] < < " " < < '| ' < < " " < <a[9] < <endl;
cout < <endl;cout < <endl;
}
int arrfull() //判断还有没有下棋的位置
{
int i;
int arrf=0;
for(i=1;i <=9;i++)
if(i==arr[i]-48) //如果字符arr[i]-48等于i
arrf=1; //那么arrf=1,也就是可以走棋