We are trying to lern Pascal and C++ in school and I just wanted to know how to do it....
But if there is no simple way, how you can help me I'll ask on another forum, but than you all for your replay :)
There are ways to do it, but they all involve platform specific functions (like Windows' WinAPI console functions) or additional libraries (ncurses), or nonstandard headers many people might not have (conio). The standard C++ lib doesn't give you a way to do it.
And again -- the main reason I'm not directly answering the question is because the question is flawed. What you are trying to do is something that probably shouldn't be done. You'll pretty much be wasting your time learning how to this in the console.
A snake game is a great beginner project.
A snake game in the console is a terrible one.
Indeed, he did say it was in pascal. Didn't see that :O
Well - like Disch said - you shouldn't do it. It's no easier - actually, probably more likely harder - than going for a more sophisticated solution than attempting to display it in the console, and the results aren't quite as satisfying either. And even if it would might for such a small game, such ad hoc solutions are completely unsuited for anything larger.
To get unbuffered input you'll need to set the console mode appropriately with SetConsoleMode(). A very simple example can be found here: http://www.cplusplus.com/forum/beginner/3523/#msg15435
Note that it is better to set the console mode in one spot and simply switch it back when you are done, and use ReadConsole() or ReadConsoleInput() to get input.
A snake game is a great beginner project.
A snake game in the console is a terrible one.
I learned how to use NCurses by writing a console snake game between classes when I was at the University. It still plays well, too. There's nothing wrong with learning something, even if it is simple.