//Program that counts the number of keys pressed until the user presses the ‘!’ key in C++
#include <iostream>
#include <conio.h>
#include <windows.h>
using namespace std;
int main()
{
int a = 0;
while (!GetAsyncKeyState(VkKeyScan('x')))
{
getch();
a++;
Sleep(100);
}
cout << "Others Keys Pressed " << a-1 << " times before pressing !." << endl;
return 0;
}
No comments:
Post a Comment