Home > Back-end >  Why don't run out
Why don't run out

Time:11-23

# include "stdio.h"
# include "math. H"
#include
#include
#include
#include
# pragma warning (4996) disable:

# define High 20
# define Width 30

Int moveDiretion;
Int food_x; Food_y;
Int canvas [High] [Width]={0};



Void gotoxy (int x, int y)//the cursor to the position (x, y)
{
HANDLE HANDLE=GetStdHandle (STD_OUTPUT_HANDLE);
COORD pos.
Pos. X=X;
Pos. Y=Y;
SetConsoleCursorPosition (handle, pos);
}

Void startup ()//data initialization
{
Int I, j;
For (I=0; I & lt; High; I++)
{
Canvas [I] [0]=1;
Canvas [I] [Width 1]=1;
}
For (j=0; J & lt; Width; J++)
{
Canvas [0] [j]=1;
Canvas [High - 1] [j]=1;
}
}

Void the show ()//
{
Gotoxy (0, 0);
Int I, j;
For (I=1; I & lt; High; I++)
{
For (j=1; J & lt;=Width; J++)
{
If (canvas [I] [j]==0)
printf(" ");//output
Else if (canvas [I] [j]==1)
printf("#");//output
}
printf("\n");
}
Sleep (50);
}

Void updateWithoutInput ()//
{

}

Void updateWithInput ()//
{


}



//function global variable definition
Int main (void)
{
Startup ();
While (1);
{
Show ();
UpdateWithoutInput ();
UpdateWithInput ();
}
}

CodePudding user response:

The code is not complete, not write what I wanted to make the output?
  • Related