Beginner here. I am working on my first real program. It is a reaction game and the user is told to press enter when an indication is displayed in the console.
Then the milliseconds it took to press enter shows up.
The problem is when the for loop runs again after the first level, the user needs to press enter twice after "Draw!".
Why does this happen? And any tips for how to fix it?
I have marked the line with an arrow.
(Sorry for the messy code. The lines got wierd with ctrl-c/ctrl-v)
This is a function that is being called in a menu (Main).
So you get input in main, and leave a newline in the input stream which needs to be extracted before you get new input. That's a common mistake when mixing formatted and unformatted input extraction.
Thanks for the replies guys! So I have now been searching for an answer to fix this but I am not sure I understand completly. Do you maybe have any advice on how to make this work with only one press on the Enter-key?