Danny said:
It doesn't appear to tell me how i can exit a program by entering a
specific key or any key
The C/C++ programming languages do not provide built in support for
keyboard / keypad devices of any kind. So there is no "standard C/C++"
answer to how one interacts with keyboard/keypad devices (e.g., how to
perform nonblocking input with a QWERTY keyboard made by company X,
whose model number is Y, and which is attached to a brand K computer
that is running operating system Z).
HOWEVER: Platform-specific tasks can performed by a C/C++ program *iff*
the C/C++ program uses platform-specific programming tools -- e.g.,
system services that the operating system's "application program
interface" (API) makes available to all programs (not just C/C++
programs); custom libraries that are designed specifically for the
OS/hardware environment you are using, etc. For example, the Win32
console API provides Windows apps (not just C/C++ apps) with a set of
keyboard, mouse, and display primitives that Windows programmers can use
in their Win32 console applications (e.g., to detect key presses; to
capture mouse events; to manipulate the console display, etc.). The
Win32 app simply calls the appropriate Win32 API function, and then the
Win32 API carries out the "request" on the program's behalf. (Note that
the Win32 API is part of the Windows OS itself.) In the Linux world,
C/C++ programmers can use the custom 'ncurses' library to perform
Linux-specific console I/O tasks.
Since these platform-specific solutions are not features of the C/C++
languages proper, there are no "standard C/C++" answers to how they are
used. (IOW, the people/companies who create these platform-specific
tools also specify how the tools must be used.) To learn more about
platform-specific programming solutions, visit the newsgroups and/or
mailing lists that are dedicated to programming issues for the
particular platform you are working with -- e.g., the Linux programming
newsgroups; the MacOS programming newsgroups; the Windows programming
newsgroups; the PalmOS programming newsgroups, etc. The folks in those
groups should be able to help you with platform-specific programming
tasks that do not have "standard C/C++" answers.