Ancient D,
Yes, I have found that out. :-/
As you must have found out, the exit(0) function exits the entire program, not just the function in which it appears.
It would appear you have the wrong notion about how to return from a function in C or C++
You surmise correctly.... I have plenty of wrong notions about C++. More so now than I'd thought I had before. :?: I barely eeeked though my two runs through C++ at college. Strike it up to playing with tonka trucks as a child, back when computers were the size of your typical house. Programs were punch cards, and my dad bought home one of the very first IC chips when I was 7. It looked to me like a black, plastic caterpillar. In fact, the original Star Trek came out that year.
int foo1() // This function will return the value of an integer { // do something // now return the integer return 1; } // or to exit a function that has no return value void foo2() { // do something return; // this line is optional. It can be omitted in void functions } int main() { // get the return value from a function that returns an integer, such as foo1() int retvalue = foo1(); // call a void function foo2(); }
Its not possible in standarc c++ to capture the <Esc> key. You have to use something nonstandard such as functions in …