Ok, my programming skills are only fairly good (I understand loops and most basic c++ code). I am writing a program for a digi-pet that displays text-based images of the pet and uses a loop to determine if the pet is hungry, bored, happy, sad, etc.
My question is in the user input area. I wish to allow the user to input a number 1-4 while the loop for the game is running but wish to set it up so if the user doesn't respond in a certain time (eg, a second) the loop just continues. This would allow the pet to get hungry when you don't feed it after a certain amount of loops and this would allow the pet to become bored if you walk away from the PC. Not feeding it would mean that the program would be able to accept a "keypress" and if one is not established, it will move on, making the pet hungrier.
Is there any way to do this using the standard header files in C++? Remember, I am not using win32 API on this program so am only looking for regular code. I have searched every corner of the web (maybe not well enough) and cannot find anything to answer my question. I would use a "cin" statement but that type of input stops the loop until the user enters information. This is unacceptable because the pet would not function without user input EACH time around the game loop. Any help is much appriciated.