Need a project done?

C++ Programming Developer

Search This Blog

Program that counts the number of keys pressed until the user presses the ‘!’ key in C++


//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

"Don't let anyone ever make you feel like you don't deserve what you want."