Hello, I have been programming in C++ for about 3 weeks now, and I have an idea for a project but I have come to a halt. I would like to know if it possible to have a loop running while also being able to detect when a user presses a key.
Output Example
"Loop Is Running
Loop Is Running
Loop Is Running
Loop Is Running
The User Pressed a Key!
Loop Is Running
Loop Is Running
Loop Is Running
Loop Is Running"
I have tried using the threads from C++11 but the program just comes to a halt as it always does with input functions (I am using getche() so that the user does not have to press enter)
Is there any way (Hopefully simple) that I can accomplish this?
TIA
The code from above should work out, just try to avoid using goto! Goto is not unnecessarily called spaghetti code! It is very messy and will eventually slatter the sauce upon you ;)