上下左右移动
while(1) { c=getch();//读取键盘的一个键 switch(c) { case 72:///上 q.y=q.y-1; system("cls"); gotoxy(q.x,q.y); continue;///一定要加continue,否则会出现不可预估的后果!!! case 80:///下 q.y=q.y+1; system("cls"); gotoxy(q.x,q.y); continue; case 75:///z左 q.x=q.x-1; system("cls"); gotoxy(q.x,q.y); continue; case 77:///右 q.x=q.x+1; system("cls"); gotoxy(q.x,q.y); continue; } }