#include"stdio.h"
#include"math.h"
#include<stdlib.h>
#include<conio.h>
#include<windows.h>
#include<time.h>
#pragma warning(disable : 4996)
#define High 20
#define Width 30
int moveDiretion;
int food_x; food_y;
int canvas[High][Width] = { 0 };
void gotoxy(int x, int y)//游標移動到(x,y)位置
{
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
COORD pos;
pos.X = x;
pos.Y = y;
SetConsoleCursorPosition(handle, pos);
}
void startup()//資料初始化
{
int i, j;
for (i = 0; i < High; i++)
{
canvas[i][0] = -1;
canvas[i][Width - 1] = -1;
}
for (j = 0; j < Width; j++)
{
canvas[0][j] = -1;
canvas[High - 1][j] = -1;
}
}
void show()//
{
gotoxy(0,0);
int i, j;
for (i = 1; i < High; i++)
{
for (j = 1; j <= Width; j++)
{
if (canvas[i][j] == 0)
printf(" ");//輸出
else if(canvas[i][j]==-1)
printf("#");//輸出
}
printf("\n");
}
Sleep(50);
}
void updateWithoutInput()//
{
}
void updateWithInput()//
{
}
//函式全域變數定義
int main(void)
{
startup();
while (1);
{
show();
updateWithoutInput();
updateWithInput();
}
}
uj5u.com熱心網友回復:
代碼不全,沒寫完想讓其輸出什么呢?轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/14300.html
標籤:C語言
上一篇:有大佬熟悉nginx代理么
下一篇:夢幻西游
