Home > Back-end >  Snake snake above a were dyed, but some bosses to solve problems
Snake snake above a were dyed, but some bosses to solve problems

Time:03-06

Small white, I am a freshman c language is a snake, I do now is to how to make his move, I now write as input w characters make snake above place were dyed, but there have been problems, sincerely hope leaders help me see, what I use is vs2019 compiler,
#include
#include
#include
#include
Void ABC (int x, int y, int see {
COORD coord1;
Coord1. * X X=2;
Coord1. Y=Y;
SetConsoleCursorPosition (GetStdHandle (STD_OUTPUT_HANDLE), coord1);
SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), see colour;
Printf (" ");
}

Void main () {
Int I, j;
For (I=0; I & lt; 20; I++) {
For (j=0; J & lt; 20; J++) {
If (I==0 | | I==19 | | j==0 | | j==19) {
ABC (I, j, 128);
}
}
}
Srand ((unsigned) time (0));
Int _x1, _y1;
18 + _x1=rand () % 1;
18 + _y1=rand () % 1;
ABC (_x1, _y1, 224);
Int _x _y;
_y=11;
_x=11;
ABC (_x _y, 208);
If (_kbhit ())
The switch (_getch ()) {
Case 'w' : ABC (_x, _y - 1, 208); break;
/* case 's' :
Case 'a' :
Case 's' : */
}

getchar();
}
  • Related