Why shouldn't you enter more than 32767, out of interest? Seems like a bit of an odd place for a cap on it anyway.
This is because the number is an integer, which has a range of -32768 to 32767.... in other words, it can only "hold" a number between the aforementioned values.
Basically a variable is assigned a set amount of "space" inside your computer's memory. The amount of space allocated determines how big the number stored inside can be. The computer stores everything in binary - 0's and 1's, so instead of something like "28", your computer would store it as 11100 which is equivalent to:
1*(2^4) + 1*(2^3) + 1*(2^2) + 0*(2^1) + 0*(2^0).
Conversely, consider the decimal system (i.e. the "28" = "twenty eight") - it can be translated as 2*(10^1) + 8 * (10^0). The logical concept is the same, only the base is different.
The number "28" in binary requires at least 6 bits of data: 5 to hold the number, and 1 to hold the sign bit, with a maximum value of 31 (or [2^5]-1).
A C++ integer has 16 bits, so it can have 15 bits allocated to the actual number (i.e. [2^15]-1 = 32767 maximum value), with 1 bit to hold the sign. If you try to assign a number beyond that, you will encounter a problem known as
overflow if the operating environment does not try to crash at that point - think Gandhi in Civ I and his insta-nuking tendencies when he unlocked democracy (I think it was called?): his peacefulness variable went over the limit and reset at 0 or something.
32768, as I recall, is a binary "Magic number" you often find troubles with in many different types of machine code.
By machine code I mean such stuff as older machine-tool controllers or PLCs attached to, say, an older power generator.
Machine code is still alive and well - we just call it
Binary nowadays. Most programming languages nowadays also convert their human-readable-code (i.e. C++) into some sort of object or assembly language first before that is converted again into machine/binary (i.e. the stuff actually read by your computer).