#include #include #include #include using namespace std; int main(int argc, char * argv[]) { int BPM = 0; int counter = 0; int start = time(NULL); char buffer[1] = ""; DWORD w; HANDLE keyboard = GetStdHandle(STD_INPUT_HANDLE); INPUT_RECORD input[1]; bool running = true; while (running) { ReadConsoleInput(keyboard, input, 1, &w); if (input[0].EventType == KEY_EVENT && input[0].Event.KeyEvent.bKeyDown) { buffer[0] = input[0].Event.KeyEvent.uChar.AsciiChar; if (buffer[0] == 13) { counter++; } } BPM = counter / (start - time(NULL)); cout << BPM; } return 0; }