您现在的位置是:主页 > news > 怎么搭建网站视频教程/全球搜
怎么搭建网站视频教程/全球搜
admin2025/6/22 3:39:54【news】
简介怎么搭建网站视频教程,全球搜,网站建立企业,上海境外输入效果:当按下左方向键时输出 “LLL”, 当按下右方向键时输出 “RRR”, 当按下上方向键时输出 “UUU”, 当按下下方向键时输出 “DDD”。 #include <stdio.h> #include <windows.h> //控制界面,获取坐标位置…
怎么搭建网站视频教程,全球搜,网站建立企业,上海境外输入效果:当按下左方向键时输出 “LLL”, 当按下右方向键时输出 “RRR”, 当按下上方向键时输出 “UUU”, 当按下下方向键时输出 “DDD”。 #include <stdio.h>
#include <windows.h> //控制界面,获取坐标位置…
效果:当按下左方向键时输出 “LLL”, 当按下右方向键时输出 “RRR”, 当按下上方向键时输出 “UUU”, 当按下下方向键时输出 “DDD”。
#include <stdio.h>
#include <windows.h> //控制界面,获取坐标位置
#include <stdlib.h> //宏文件
#include <conio.h> //接受键盘的输入输出#define U 1
#define D 2
#define L 3
#define R 4int key1,key2;
int status;void snakemove()
{if(status == L){printf("LLLLLLLLLLL");}if(status == R){printf("RRRRRRRRRRR");}if(status == U){printf("UUUUUUUUUUU");}if(status == D){printf("DDDDDDDDDDD");}
}void keyboardControl()
{status=R;snakemove();//RRRprintf("\n");while(1){if (key1 = _getch()){key2 = _getch();}if(key2==72)//方法一,up代表72,down代表80,left代表77,right代表75{status = U; //UUUsnakemove();printf("\n");}if(GetAsyncKeyState(VK_DOWN)!=0)//方法二{status = D;//DDDsnakemove();printf("\n");}if(GetAsyncKeyState(VK_LEFT)!=0){status = L;//LLLsnakemove();printf("\n");}if(GetAsyncKeyState(VK_RIGHT)!=0){status = R;//RRRsnakemove();printf("\n");}}
}int main()
{keyboardControl();return 0;
}