Do note that it's a||b, and not a|b. Although with this particular mini-program the end result is the same (that's just coincidence). 5||2 evaluates to 1, whereas 5|2 evaluates to 7. This program works by coincidence either way because 0||0 = 0|0 = 0. And to add to the confusion, a|b is a bit-wise OR operator, not an add (which is also coincidence: 5|2 just happens to equal 5+2 in this case).
Using a|b when a||b is intended is a very typical c++ noob mistake.