#include "wz.h"/*int check3 (Int x[][5]) { int i,j; int sum=0;for (i=0;i<5;i++) { for (j=0;j<5;j++) sum+=x[i][j]; }if (sum==1) return 1;else return 0;} */int check3 (Int x[][5]) { int i,j; for (i=0;i<5;i++) { for (j=0;j <5;j++) if (x[i][j]==1) return 1; break; } return 0;} Void show (Int x[][5]) { int i,j; for (i=0;i<5;i++) { for (j=0;j<5;j++) printf ("%2d", X[i][j]); printf ("\ n"); } }void play (Int v[][5],int x,int y) { v[x][y]=1-v[x][y]; if (x==0&&y==0) { v[x][y+1]=1-v[x][y+1];v[x+1][y]=1-v[x+ 1][y];} if (x==0&&y==4) { v[x][y-1]=1-v[x][y-1];v[x+1][y]=1-v[x+1][y];} if (x==4&&y==0) { v[X][y+1]=1-v[x][y+1];v[x-1][y]=1-v[x-1][y];} if (x==4&&y==4) { v[x][y-1]=1-v[x][y-1];v[x-1][y]=1-v[x-1][y];} if (x==0&&y!=0&&y!=4) { v[x][y-1]=1-v[x][y-1]; v[x][y+1]=1-v[x][y+1]; v[x+1][y]=1-v[x+1][y]; } if ( x!=0&&x!=4&&y==4) { v[x-1][y]=1-v[x-1][y]; v[ X][y-1]=1-v[x][y-1]; v[x+1][y]=1-v[x+1][y]; } if (x==4&&y!=0&&y!=4) { v[x][y+ 1]=1-v[x][y+1]; v[x][y-1]=1-v[x][y-1]; v[x-1][y]=1-v[x-1][y]; } if (x=!4&&x!=0&&y==0) { v[x][y+1]=1-v[x][y+1]; v[x+1][y]= 1-v[x-1][y]; v[x-1][y]=1-v[x-1][y ]; &nbsP; } else {v[x-1][y]=1-v[x-1][y];v[x][y-1 ]=1-v[x][y-1];v[x+1][y]=1-v[x+1][y];v[x][y+1]=1-v[x][y+1]; }}main () {int v[5] [5]={1};int i,j,state=0;int x,y;int m=0;show (v); if (Check3 (v)) printf ("wzzx\n"); while (Check3 (v) >0) { printf ("ckeack is %d\n", Check3 (v)); //printf ("enter x and y\n "); //scanf ("%d ", &x); &NBSP;SCANF ("%d ", &y); &NBSP;&NBSP;SCANF ("%d ", &m); &NBSP;&NBSP;X=M/10 y=m%5; printf (" (%d,%d) \ n", x, y); if (x>=0&&x<5&&y>=0& &y<5) {play (v,x,y); show (v);} else { printf ("error ,play again \n"); } }}
If statement should have problem output inconsistent with expected
C Before you go to sleep, please turn off the light for the first time