#include <iostream> #include <windows.h> #include <conio.h> #include <vector> using namespace std; int main(int argc, char** argv) { HANDLE handle=GetStdHandle(STD_OUTPUT_HANDLE); int x,y; COORD coord={10,5}; SetConsoleCursorPosition(handle,coord); char a[]={'s','s','s','s','<','s','s','s','s','>','<','a','a','>','d','d','d','<','w','w','w','w','>','<','d','d','d','<','w','w','w','w','>','<','s','s','s','s','>','d','d'}; vector<char> b(a,a+sizeof(a)/sizeof(char)); cout<<"兴"; for(int i=0;i<b.size();i++){ SetConsoleCursorPosition(handle,coord); cout<<"-"; switch(a[i]){ case 119: coord.Y--;break; case 97: coord.X--;break; case 100: coord.X++;break; case 115: coord.Y++;break; case 60: x=coord.X;y=coord.Y; case 62: coord.Y=y;coord.X=x; default: break; } Sleep(100); SetConsoleCursorPosition(handle,coord); cout<<"-"; } SetConsoleCursorPosition(handle,coord); cout<<"兴"; return 0; }
标签:显示,handle,int,char,HANDLE,屏幕,include,sizeof From: https://www.cnblogs.com/liujiaxing-/p/18211623