#include "wz.h" #include "sts.h" #define max 5void show (Int arr[][max]) { for ( int i=0;i<max;i++) { for (int j=0;j<max;j++) { cout <<arr[i][j]<< " "; } cout<<endl; } cout<< Endl;} Void play (int arr[][max],int x,int y) { if (x < 0 | | y < 0 | | x >= max | | y >= max) { return ; } arr[x][y] = 1 -arr[x][ Y]; if (x-1 >= 0) { arr[x-1][y] = 1 - arr[x-1][y]; } if (X+1 < max) { arr[x+1][y] = 1 - arr[x+1][y]; } if (y-1 >= 0) { arr[x][y-1] = 1 - arr[x][y-1]; } if (Y+1 < max) &NBSP;{&NBSP;&NBSP;ARR[X][Y+1]&NBSP;=&NBSP;1&NBSP;-&NBSP;ARR[X][Y+1];&NBSP;}}&NBSP;&NBSP;VOID&NBSP;CP (Int v[][max],int k,int a[],int b[]) { int i; for (i=k;i>0;i--) { play (V,a[i],b[i]); show (v);} cout<< "Computer display complete system has exited " <<ENDL; static int cc=1;int player () { while (CC) { int a [100]={0};int b[100]={0}; int v[max][max] = {0}; int x,y; int k=3,i=0; int state= 1; time_t t; srand ((unsigned) time (&t)); k=rand ()%5+1; cout<< "sleep before lights out." Welcome to section "<<CC<< " Off" <<endl; cc++;while (i++<k) { x=rand ()%5; y=rand ()%5; a[i]=x;b[i ]=y; play (v,x,y);} show (v); while ( state) { cout<< "Sleep before lights out Enter coordinates (x, y), (0,0) exit" <<endl; cin>>x>>y; if (x==0&&y==0) cc=0; x=x-1;y=y-1; if (x>-1&&x<5&&y>-1&&y<5) { i++; a[i]=x;b[i]=y; if (i++==100) { cout<< "Computer display player steps too many, system has exited " <<endl;state=0;} play (v,x,y); show (v); } if (x+y>10) {&NBSP;CP (v,i+1,a,b); state=0;} } }}int main () { cout<< "****** "<<endl; cout<<" Welcome to participate in the lighting game <<endl<< provided by Wzzx "<<endl; cout& Lt;< " in the process of entering x+y greater than 10 can choose the computer demonstration solution steps " <<endl; cout<< "* "<<endl; player (); return 0;}
Please turn off the lights before you go to sleep version