How would one break out of a function with either pressing the space bar, enter, or 0 key? My goal is to create a timer in c++ that keeps the timer ticking, but when one presses either anykey, or one of the following three keys, then it will stop the process and give the timers last result.

Hi,
In this kind of a program the support is required from the Operating System. Depending upon OS yo have couple of choices ( and ofcourse compiler too). I cannot think of a single generic routine. Although if your application is a simple demo kind of a thing you can simulate the required behaviour using kbhit function. and then checking which key was pressed.
A more sophiticated implementation could be done via threads. Let one thread monitor the keyboard and anotherwork on your timer counter.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.