So I have a project I'm working on. There are boxes, all monitored as open or shut (int or bool value). In the project there are three cases. (1) The user opens the correct box (has it's own consequences, but is finished), (2) opens the wrong box and takes out an item, or (3) opens the wrong box and does NOT take out an item. The problem is this: if case 2 occurs, I need to be able to stop the loop. The problem is that I cannot pause the loop to check with something simple like cin, etc. So the idea is that the loop continues unless there is a keystroke, but not necessarily a pausing-type input. I have no idea how to do this, however, or even what I would search for to find something like this.
IE:
int boxOpened, rightBox = 3;
bool itemPicked = false;
do{
get_box_status(); // says which box is opened
/* some kind of check for a space bar stroke (status stored in itemPicked), or an arrow key, or whatever, to indicate they got out an item. if they press the key, or any (whichever method works better) at any point in the loop, the loop ends. */
} while ((boxOpened != rightBox)&&(!itemPicked));
I don't know if it's event logging/notification/identification or multithreading (not sure what that is), so I can't even really search for it...
