I am making a game in Visual studious 2017 (visual c++), where you have to repeatedly press the space bar to earn money. But I have run into a problem, the compiler can't keep up when you press the spacebar really fast and so It miscounts. I tried doing some research, but all I got was this and as I said earlier it cant keep up.
this is so far what i got:
   int click_systm()
 {
char spacebar;
while (1)
{
    if (GetAsyncKeyState(VK_SPACE) != 0)
    {
        if (GetKeyState(VK_SPACE) == 0)
        {
            spacebar = _getch();
            int value = spacebar;
            if (value == 32)
            {
                money++;
                cout << money << endl;
                
            }
        }
    
    }
}
   }
If you made it here, thanks for taking your time to read this :)
 
    