谁能帮我用C语言设计一个小游戏。。(C++)

# include & ltstdio.h & gt

#定义编号10

void welcome();

void initqipan();

void show qi(int I);

void save(int p);

void panduan(int p);

void何琪();

void over();

int Zou Qiang();

int Zou qilie();

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */struct zoo Biao

{

int x[N * N];

int y[N * N];

}魏徵[N * N];* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

int main()

{

int p = 0;

welcome();

init qipan();

for(p = 1;p & lt= N * Np++)

{

魏徵[p]。x[p] =邹启航();

魏徵[p]。y[p] =邹启烈();

保存(p);

show qi(p);

潘端(p);

}

如果(p == N * N)

何琪();

over();

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

void initqipan()

{

int i,j;

for(I = 0;我& ltn;i++)

{

printf("%d ",I);

printf(" ");

}

printf(" \ n ");

for(I = 1;我& ltn;i++)

{

for(j = 0;j & ltn;j++)

{

如果(j == 0)

printf("%d ",I);

其他

printf(" ");

}

printf(" \ n ");

}

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

void showqi(int p)

{

int i,j,k,m;

int a[N * N],b[N * N];

FILE * fp

fp = fopen("wuzi_list "," Rb ");

for(I = 1;我& lt= N * Ni++)

{

弗雷德(& amp魏徵[i],sizeof(struct左标),1,FP);

魏徵。x[I];

魏徵。y[I];

} for(m = 1;m & ltp;m++)

{

而(魏徵[p]。x[p]= = a[m]& amp;& amp魏徵[p]。y[p] == b[m])

{

printf("错误!\ n ");

魏徵[p]。x[p] =邹启航();

魏徵[p]。y[p] =邹启烈();

m = 1;

}

}

for(I = 0;我& ltn;i++)

{

printf("%d ",I);

printf(" ");

}

printf(" \ n ");

for(I = 1;我& ltn;i++)

{

for(j = 1;j & ltn;j++)

{

如果(j == 1)

printf("%d ",I);

for(k = 1;k & lt= p;k++)

{

if (i ==魏徵[k]。x[k]& amp;& amp魏徵[k]。y[k])

{

if (k % 2 == 1)

{

printf("○");

打破;

}

else if (k % 2 == 0)

{

printf("●");

打破;

}

}

}

if(k & gt;p)

printf(" ");

其他

继续;

}

printf(" \ n ");

}

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

int走棋行()

{

int x;

Printf("请输入要移动的棋子行数!\ n ");

printf(" x = ");

scanf("%d ",& ampx);

while(x & gt;n-1 | | x & lt;1)

{

printf("错误!\ n ");

Printf("请输入要移动的棋子行数!\ n ");

printf(" x = ");

scanf("%d ",& ampx);

}

返回x;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * *

int zouqilie()

{

int y;

Printf("请输入棋子要移动的列数!\ n ");

printf(" y = ");

scanf("%d ",& ampy);

while(y & gt;n-1 | | y & lt;1)

{

printf("错误!\ n ");

Printf("请输入棋子要移动的列数!\ n ");

printf(" y = ");

scanf("%d ",& ampy);

}

返回y;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

无效保存(整数I)

{

FILE * fp

fp = fopen("wuzi_list "," WB ");

fwrite(& amp;魏徵[i],sizeof(struct左标),1,FP);

}/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */Voidpanduan(int p)

{

int i,j,k[8] = { 1,1,1,1,1,1,1,1,1,};

int a[N * N],b[N * N];

FILE * fp

fp = fopen("wuzi_list "," Rb ");

for(I = 1;我& lt= p;i++)

{

弗雷德(& amp魏徵[i],sizeof(struct左标),1,FP);

魏徵。x[I];

魏徵。y[I];

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */for(I = 1;我& lt= p;i++)

{

if (i % 2 == 1)

{

for(j = 1;j & lt= p;j = j + 2)

{

if((a[I]= = a[j])& amp;& amp(b[i] == b[j] - 1))

{

k[0]++;

继续;

}

else if((a[I]= = a[j])& amp;& amp(b[i] == b[j] - 2))

{

k[0]++;

继续;

}

else if((a[I]= = a[j])& amp;& amp(b[i] == b[j] - 3))

{

k[0]++;

继续;

}

else if((a[I]= = a[j])& amp;& amp(b[i] == b[j] - 4))

{

k[0]++;

继续;

}

else if (k[0] == 5)

{

printf("玩家1获胜!!!\ n ");

}

其他

继续;

}

if (k[0] == 5)

打破;

k[0]= 1;

}

else if (k[0] == 5)

打破;

else if (i % 2 == 0)

{

for(j = 2;j & lt= p;j = j + 2)

{

if((a[I]= = a[j])& amp;& amp(b[i] == b[j] - 1))

{

k[1]++;

继续;

}

else if((a[I]= = a[j])& amp;& amp(b[i] == b[j] - 2))

{

k[1]++;

继续;

}

else if((a[I]= = a[j])& amp;& amp(b[i] == b[j] - 3))

{

k[1]++;

继续;

}

else if((a[I]= = a[j])& amp;& amp(b[i] == b[j] - 4))

{

k[1]++;

继续;

}

else if (k[1] == 5)

{

printf(" 2号玩家赢了!!!\ n ");

}

其他

继续;

}

if (k[1] == 5)

打破;

k[1]= 1;

}

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

for(I = 1;我& lt= p;i++)

{

if (k[0] == 5 || k[1] == 5)

打破;

else if (i % 2 == 1)

{

for(j = 1;j & lt= p;j = j + 2)

{

if((a[I]= = a[j]-1)& amp;& amp(b[i] == b[j]))

{

k[2]++;

继续;

}

else if((a[I]= = a[j]-2)& amp;& amp(b[i] == b[j]))

{

k[2]++;

继续;

}

else if((a[I]= = a[j]-3)& amp;& amp(b[i] == b[j]))

{

k[2]++;

继续;

}

else if((a[I]= = a[j]-4)& amp;& amp(b[i] == b[j]))

{

k[2]++;

继续;

}

else if (k[2] == 5)

{

printf("玩家1获胜!!!\ n ");

}

其他

继续;

}

if (k[2] == 5)

打破;

k[2]= 1;

}

else if (k[2] == 5)

打破;

else if (i % 2 == 0)

{

for(j = 2;j & lt= p;j = j + 2)

{

if((a[I]= = a[j]-1)& amp;& amp(b[i] == b[j]))

{

k[3]++;

继续;

}

else if((a[I]= = a[j]-2)& amp;& amp(b[i] == b[j]))

{

k[3]++;

继续;

}

else if((a[I]= = a[j]-3)& amp;& amp(b[i] == b[j]))

{

k[3]++;

继续;

}

else if((a[I]= = a[j]-4)& amp;& amp(b[i] == b[j]))

{

k[3]++;

继续;

}

else if (k[3] == 5)

{

printf(" 2号玩家赢了!!!\ n ");

}

其他

继续;

}

if (k[3] == 5)

打破;

k[3]= 1;

}

}/* * * * * * * * * * * * * *判断对角线(左上-右下)* * * * * * * * * * * *

for(I = 1;我& lt= p;i++)

{

if(k[0]= = 5 | | k[1]= = 5 | | k[2]= = 5 | | k[3]= = 5)

打破;

else if (i % 2 == 1)

{

for(j = 1;j & lt= p;j = j + 2)

{

if((a[I]= = a[j]-1)& amp;& amp(b[i] == b[j] - 1))

{

k[4]++;

继续;

}

else if((a[I]= = a[j]-2)& amp;& amp(b[i] == b[j] - 2))

{

k[4]++;

继续;

}

else if((a[I]= = a[j]-3)& amp;& amp(b[i] == b[j] - 3))

{

k[4]++;

继续;

}

else if((a[I]= = a[j]-4)& amp;& amp(b[i] == b[j] - 4))

{

k[4]++;

继续;

}

else if (k[4] == 5)

{

printf("玩家1获胜!!!\ n ");

}

其他

继续;

}

if (k[4] == 5)

打破;

k[4]= 1;

}

else if (k[2] == 5)

打破;

else if (i % 2 == 0)

{

for(j = 2;j & lt= p;j = j + 2)

{

if((a[I]= = a[j]-1)& amp;& amp(b[i] == b[j] - 1))

{

k[5]++;

继续;

}

else if((a[I]= = a[j]-2)& amp;& amp(b[i] == b[j] - 2))

{

k[5]++;

继续;

}

else if((a[I]= = a[j]-3)& amp;& amp(b[i] == b[j] - 3))

{

k[5]++;

继续;

}

else if((a[I]= = a[j]-4)& amp;& amp(b[i] == b[j] - 4))

{

k[5]++;

继续;

}

else if (k[5] == 5)

{

printf(" 2号玩家赢了!!!\ n ");

}

其他

继续;

}

if (k[5] == 5)

打破;

k[5]= 1;

}

}/* * * * * * * *判断对角线(左下-右上)* * * * * * * * *

for(I = 1;我& lt= p;i++)

{

if(k[0]= = 5 | | k[1]= = 5 | | k[2]= = 5 | | k[3]= = 5 | | k[4]= = 5

|| k[5] == 5)

打破;

else if (i % 2 == 1)

{

for(j = 1;j & lt= p;j = j + 2)

{

if((a[I]= = a[j]+1)& amp;& amp(b[i] == b[j] - 1))

{

k[6]++;

继续;

}

else if((a[I]= = a[j]+2)& amp;& amp(b[i] == b[j] - 2))

{

k[6]++;

继续;

}

else if((a[I]= = a[j]+3)& amp;& amp(b[i] == b[j] - 3))

{

k[6]++;

继续;

}

else if((a[I]= = a[j]+4)& amp;& amp(b[i] == b[j] - 4))

{

k[6]++;

继续;

}

else if (k[6] == 5)

{

printf("玩家1获胜!!!\ n ");

}

其他

继续;

}

if (k[6] == 5)

打破;

k[6]= 1;

}

else if (k[6] == 5)

打破;

else if (i % 2 == 0)

{

for(j = 2;j & lt= p;j = j + 2)

{

if((a[I]= = a[j]+1)& amp;& amp(b[i] == b[j] - 1))

{

k[7]++;

继续;

}

else if((a[I]= = a[j]+2)& amp;& amp(b[i] == b[j] - 2))

{

k[7]++;

继续;

}

else if((a[I]= = a[j]+3)& amp;& amp(b[i] == b[j] - 3))

{

k[7]++;

继续;

}

else if((a[I]= = a[j]+4)& amp;& amp(b[i] == b[j] - 4))

{

k[7]++;

继续;

}

else if (k[7] == 5)

{

printf(" 2号玩家赢了!!!\ n ");

}

其他

继续;

}

if (k[7] == 5)

打破;

k[7]= 1;

}

}

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

无效何琪()

{

printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n ");

printf("平局!!!\ n ");

printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n ");

}/* * * * * * * * * * * *游戏结束* * * * * * * * * * * * * * * */Voidov()

{

printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n ");

printf("游戏结束!!!\ n ");

printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n ");

}/* * * * * * * * * * * * * * * *游戏上* * * * * * * * * * * * * */void欢迎()。

{

printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n ");

printf("欢迎!!!\ n ");

printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n ");

}

以上是五子棋代码