贪吃蛇游戏

模仿http://zhidao.baidu.com/link?url=73YIrvyI57-_a7ur1H2rK1xjdK8oeTnUu28z6bL0hD28HOaLeeRoEYCh3p2YRTrKM0NP20atWAdFhnOklpMGn_

#include
#include
#include
#include
#include
using namespace std;

#define N 20
int wall[N+2][N+2]={{0}};
void gotoxy(int x,int y)
{
	COORD pos;
	pos.X=2*x;
	pos.Y =y;
	SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}
void setcolor(int a)
{
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),a);
}
void init(int apple[2])
{
	int i,j;
	setcolor(15);
	for(i=0;i0;i--)
		{
			snake[i][0]=snake[i-1][0];
			snake[i][1]=snake[i-1][1];
			gotoxy(snake[i][0],snake[i][1]);
			setcolor(14);
			cout<<"★"<


你可能感兴趣的:(C++应用,C++学习)