<stdlib.h> (or <cstdlib> -- http://www.cplusplus.com/reference/clibrary/cstdlib/) contains important stuff. Of particular use are the standard macros EXIT_SUCCESS and EXIT_FAILURE, not to mention abort() and exit().
This is the simplest proper, portable C++ program:
I tested out your code with <iostream> instead of <cstdlib>, and it worked perfectly. So did the abort() and exit() functions. I'm guessing that stdlib is no longer needed. Thanks though.
@youngcoder, If you're going to use EXIT_SUCCESS, you must include <cstdlib>. Your compiler probably includes it from within iostream, another compiler may not be so lenient.