Using getch() function

This is a discussion on Using getch() function within the C++ Programming forums, part of the General Programming Boards category; I need to get input without having to press enter.
Something like:
cout<<"Enter a Number"<<endl;
--Something goes here--
switch(number){
case ...

so...

if you had a picture on the screen that you wanted the user to move around, you could use something like that to do it. like put it in a loop. then just change the position and re-draw acording to what they put in. something like that, eh? for msvc++ 6 do you still have to use the _getch(); ? or _getche(); ?

Using cout wil place output in a buffer that is normally flushed automatically when cin is used to obtain input. getch() isn't buffered and cout's buffer will not be flushed when it's used to get input. If you're using both you should use flush or endl before using getch(). -