I have a sort of game I have created that takes input from the terminal window and uses it to manipulate an array also in the terminal. My problem is that I want the array to update regardless of whether the player has inputted anything. So I cannot use something like
1 2 3 4 5 6
while(1)
{
system("cls") //Clear the screen to put the array back up
PrintBoardtoTerminal() //Print the board to the terminal window
cin >> manipulate; //Get the text to manipulate the array
}
because then the program would wait for me to input something before looping again. Basically I just want the first two lines to go regardless of whether I enter something or not. Any help would be appreciated!
I think that the OP wants to have a continuous event loop, entirely skipping over the input process if there is no input to be handled. There is no way to do this with standard C++ - you will generally have to use OS specific methods to do this.
Alternately, if you are making a game, use graphics instead. 2D graphics is just as easy, if not easier than doing the same thing in the terminal. Examples of good, popular libraries for doing this include SFML, SDL and Allegro, and if you want to get lower level, you could use OpenGL with freeGLUT or GLFW instead. SFML is probably the easiest, but its all down to personal preference.