我所限定的四个箭头键作为such-检测为双方向上和向右C++,向上箭头
#define UP_ARROW 72
#define LEFT_ARROW 75
#define DOWN_ARROW 80
#define RIGHT_ARROW 77
并且键正在使用_getch()检查,因为这样的
char key = _getch();
if (key == 0 || key == -32)
{
key = _getch();
switch (key)
{
case UP_ARROW:
//These are functions not relevant to the problem
//up(1);
case DOWN_ARROW:
//down(1);
case LEFT_ARROW:
//left(1);
case RIGHT_ARROW:
//right(1);
//Pressing up will print out "test", which should not happen
printf("test");
}
}
作为评论说,按下会在RIGHT_ARROW情况下调用任何东西。我做错什么了吗?