include<stdio.h>
int main(){
char director;
printf("请输入方向:W(上) S(下) A(左) D(右)\n" );
while(1){
scanf("%c",&director);
switch(director){
case 'w':
case 'W':
printf("上\n");
break;
case 's':
case 'S':
printf("下\n");
break;
case 'a':
case 'A':
printf("左\n");
break;
case 'd':
case 'D':
printf("右\n");
break;
}
}
return 0;}
感觉这样写很low,有没有好的方法 |
|