I took a look at your code and my first reaction was.. OMG
Understanding another's code is not the simplest thing but you make it a lot harder !
First you need to use object in C++ and not put everything in the main or in the file main.cpp
Your indenting is not the simplest either.
Considering all that, I'd consider using events differently.
Since you get the keyboard status in each frame, you shouldn't put verifications INTO the pollEvent loop, but outside, and making it time dependent.
Finally, you should try and follow a few basic tutorials about C++ to write it differently, I'm not really surprised by the fact you're managing to find where the problem is from with that code.
Hope I'm not being too harsh but people can correct me if I'm wrong.