This is a remnant of the C/Unix legacy.
If your program is being called within a script, is is useful for the script to know whether your program was successful. Thus, was born the convention of returning 0 for success from executable programs.
C did not have native boolean types, so this was an integer. And this allowed us to return different numbers for different kinds of errors.
This convention then spread to regular functions, since, as others have posted, C/C++ did not originally have exceptions, and even once we had exceptions, it took discipline to use them correctly, and there was a lot of legacy code (and legacy programmers) using the return value convention.
If all you're interested in is success/failure, then 0 for failure and 1 for success will do. For internal return values, even if there are currently only two values, I would advise using an enum
type instead since bi-states have a way of evolving into tri-states, and it will be easier to follow what you're doing.