Home > Back-end >  C snake mailbox console error
C snake mailbox console error

Time:01-19


The code below
X # include #include #include ? # define MAP_WIDTH//# define the average width of 60 MAP_HEIGHT 20//average height? Struct snake {//x coordinate int x; ?//int y y coordinates; ?//@ or * char ch; };//array structure: on behalf of the snake struct snake g_snake [MAP_WIDTH * MAP_HEIGHT];//the length of the snake actual int g_snake_length=5; Void SetPos (int x, int y) {? COORD point={x, y};//the location of the cursor to set up the x, y HANDLE HOutput=GetStdHandle (STD_OUTPUT_HANDLE);//use the GetStdHandle (STD_OUTPUT_HANDLE) for standard output handle SetConsoleCursorPosition (HOutput, point);//set the cursor position}? Void DrawSnake () {int I=0; For (I=0; I & lt; G_snake_length; I++) {//set the coordinates to (0, 0) position SetPos (g_snake [I] x, g_snake [I] y); ?//draw the snake * * * * printf (" % c ", g_snake [I] ch); }???? }? Void HideCorsor ()? {? HANDLE fd=GetStdHandle (STD_OUTPUT_HANDLE); ? CONSOLE_CURSOR_INFO cinfo; ? Cinfo. BVisible=0; ? Cinfo. DwSize=1; ? If (SetConsoleCursorInfo (fd, & amp; Cinfo))? Printf (" execution success \ n "); ? else? Failed to perform printf (" \ n "); ? ? } int main () {//hide the cursor HideCorsor (); Int I, j;//[0,21) for (j=0; j
  • Related