Learning C-Style C++


by Direct Approach Mentoring



getch()

7. Input


You can talk TO the user, but how do you get information FROM the user?

There are a lot of ways to do this, but the simplest is probably

getch()



getch()

will return for you a number representing whatever key the user presses on their keyboard.

getch()

will return the key-code right away if the user has already pressed a key. On the other hand, if the user has not pressed a key, it will wait until he or she does. During this time your program is paused. It will wait forever if the user never presses a key.


(More coming soon!)