该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
我看了好多例子。。。。又编出一个,但就是有几个错误,一直找不出,求助!!
下面我发下我的帖子。。。。
#include
#include
#include
void gotoxy(int a,int b)
{ int x=0x0b;
HANDLE hInput, hOutput;
COORD loc;
loc.X = a;
loc.Y=b;
hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hOutput, loc);
} #include
#include
#in
void main()
{
struct move_point
{ int x, y;
int xv, yv;
}man;
man.x=man.y=0;
char key=0;
system("cls");
while(1)
{ gotoxy(man.x, man.y);
printf("%c\b", 2);
printf(" ");
key=getch();
switch(key)
{
case '38':
gotoxy(man.y,++man.y);
break;
case '40':
gotoxy(man.y,--man.y);
break;
case '37':
gotoxy(man.x,--man.x);
break;
case '39':
gotoxy(man.x,++man.x);
break;
default:
break;
}
}
getch();
}