input while the processing is still going on

hey is there a way that i can take a character input,while my loops are still processing/working?
and we dont to press enter
like in the function getch();
but when i use getch the screen freezez for a input by the user and my loops pauses?
so can i have a solution to it
thx for the help
sorry if i broke some rules or something i am new to c++ compiler and this web forums
Depends what you mean by "loops still working".
If you want to grab input, you need to write a code that will grab this input. You can't do it other way. Therefore, your loops would need to include code for grabbing input.

If you can change your loops as I suggested, you can do it. It would require using proper functions, depending on what framework your program is using.
editing....
i dont get it
maybe the part of grabing input,whats that
i want my codes such that
i make a game of rattle snake
where i want my snake to keep moveing unless or untill i press left or right key
but if i use a getch function in the snakes pos changeing code then my code and snake would stop moveing and wait for a input
Last edited on
Yeah. You need to check if a player pressed key, end if he did, get this input.

You may want to check this lessons:
http://www.3dbuzz.com/training/view/c-plus-plus-complete/intro-to-game-dev/introduction-c-level-iii

They will introduce you to creating game basics quite easily, you will create functioning game in console and solve aspects that you are mentioning.

PS. It will be easier for you to go through this lesson then to read explanation, because the thing you are describing depends on what library/framework you are using.
Last edited on
would look forward reading it....
hey i found a easier way
just by includeing bios.h
and with the help of the function
bioskey(0);//to wait for input
bioskey(1);//not to wait for input
and well i was using simple turbo c++
Topic archived. No new replies allowed.