0
已解决
李宜和
高级启示者
高级启示者
#include <bits/stdc++.h>
#include<windows.h>
#include<iomanip>
#include<stdio.h>
#include<cstdlib>
#include<ctime>
using namespace std;
int main(){
srand(time(0));
CONSOLE_CURSOR_INFO info = { 1, 0 };
HANDLE hand = GetStdHandle( STD_OUTPUT_HANDLE );
COORD coord={ 0, 0 };
POINT pt={ 0, 0 };
SetConsoleCursorInfo( hand, &info );
string a="点击鼠标左键。",b="按Tab键。",c="按回车键。",d="按End键",e="按Page Up键",f="按Page Down键";
int m,cnt=0;
while(1){
while(1){
m=rand()%6+1;
if(m==1){
cout<<a<<endl;
Sleep(2000);
if(GetAsyncKeyState(VK_LBUTTON)&0x01){
break;
}else{
cout<<"失败" ;
cnt=1;
break;
}
}
if(m==2){
cout<<b<<endl;
Sleep(2000);
if(GetAsyncKeyState(VK_TAB)&0x09){
break;
}else{
cout<<"失败" ;
cnt=1;
break;
}
}
if(m==3){
cout<<c<<endl;
Sleep(2000);
if(GetAsyncKeyState(VK_RETURN)&0x8000){
break;
}else{
cout<<"失败" ;
cnt=1;
break;
}
}
if(m==4){
cout<<d<<endl;
Sleep(2000);
if(GetAsyncKeyState(VK_END)&0x23){
break;
}else{
cout<<"失败" ;
cnt=1;
break;
}
}
if(m==5){
cout<<e<<endl;
Sleep(2000);
if(GetAsyncKeyState(VK_PRIOR)&0x21){
break;
}else{
cout<<"失败" ;
cnt=1;
break;
}
}
if(m==6){
cout<<f<<endl;
Sleep(2000);
if(GetAsyncKeyState(VK_NEXT)&0x21){
break;
}else{
cout<<"失败" ;
cnt=1;
break;
}
}
}
if(cnt==1){
break;
}
}
return 0;
}
增加了可玩**,可以不在为按不到某个键而烦恼
看我玩的:
真香