I want to use getch() or something similar to register a keystroke in a while() function.
while()
{
.
.
.
if(kbhit()) k=getch();
else cout<<"no input";
cout<<k<<endl;
k=0;
Sleep(1200);
.
.
.
}
If i hold a key, the function will keep displaying that key for a while. I will use a similar code to implement movement for a worm game. If a key will not be pressed the worm will keep going int he direction it's facing (but i don't need help with this i already have it sorted out).
I just need to know how do i register just 1 key press for a while cycle. Using Codeblocks.