#include <bits/stdc++.h> #include <windows.h> #include <conio.h>//控制台输入输出头文件 using namespace std; int main(){ HANDLE handle=GetStdHandle(STD_OUTPUT_HANDLE);//获取标准输出的句柄 COORD coord={8,0};//保存光标坐标 SetConsoleCursorPosition(handle,coord); cout<<"H"; char a[]={'s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w'}; vector<char> b(a,a+sizeof(a)/sizeof(char)); while(1){ for(int i=0;i!=b.size();i++){ if(b[i]=='w'||b[i]=='s'||b[i]=='a'||b[i]=='d'){ switch(b[i]){ case 'w': coord.Y--;break; case 's': coord.Y++;break; case 'a': coord.X++;break; case 'd': coord.X--;break; default: break; } SetConsoleCursorPosition(handle,coord); cout<<"H"; Sleep(1000); } } return 0; } return 0; }
标签:case,handle,++,666,coord,break,include From: https://www.cnblogs.com/fushuxuan/p/18211632