Is there a way to check for imput with out pausing and promting for imput? if i use:
cin >> somecharacter;
it pauses everything and waits till you give a character. How can i ask for imput and keep my program going.
thanks.
Printable View
Is there a way to check for imput with out pausing and promting for imput? if i use:
cin >> somecharacter;
it pauses everything and waits till you give a character. How can i ask for imput and keep my program going.
thanks.
Code:
int main()
{
char Input=0;
while(Input!=27) //Loop while ESC is not pressed.
{
Input=0;
if(kbhit()) Input=getch(); //Store the pressed key (if a key is pressed)
//Your code
}
}
For that code to work, don't forget to #include <conio.h>