|
- #include<bits/stdc++.h>
- #include<conio.h>
- #include <windows.h>
- using namespace std;
- char ch;
- void gotoxy(HANDLE hout, int x, int y);
- void gotoxy(HANDLE hout, int x, int y){
- COORD pos;
- pos.X = x;
- pos.Y = y;
- SetConsoleCursorPosition(hout, pos);
- };
- int main(){
- HANDLE hout = GetStdHandle(STD_OUTPUT_HANDLE);
- system("cls");//清屏
- cout<<1<<'\n';
- Sleep(10);
- gotoxy(hout,0,0);
- cout<<2<<'\n';
- while(1)
- {
- if(kbhit()){
- ch=getch();
- if(ch='w')
- {
- cout<<"this is w"<<'\n';
- }
- }
- }
- return 0;
- }
复制代码
|
|