Note: This essay is directly transcribed in the C++primer (fourth edition) Exercise solution (full version). Here is mainly for the convenience of my repeated reading later.
Exercise 1.2
Modify the program so that it returns-1. The return value of 1 is typically an indicator that the program failed to run. However, the system differs, how (or even) reports that the main function fails to run differently. Recompile and run the program again to see how your system handles the run failure indicator of the main function.
The Windows operating system used by the author does not report that the main function failed to run, so there is no difference between a program returning 1 or returning a 0 run effect. However, if you run the program at a DOS command prompt and then type the echo%errorlevel% command, the system displays a return value of 1.
C + + Primer fourth Edition after-school practice solution Exercise 1.2