You can often see the while (~ Code such as scanf ("% d", & N) {} indicates that the loop ends when the input ends.
Generally, when the input stream ends, scanf returns EOF.
EOF is a constant defined in the header file stdio. H, which is generally-1.
The source code of-1 is 10000001, the reverse code is 1111110, and the supplementary code is 11111111. Review: The original codes, backcodes, and supplementary codes of positive numbers are the same. The original codes of negative numbers are 1, the original codes of negative numbers are unchanged, and the rest are reversed, the complement is (for the original code) the symbol bit remains unchanged, the rest is reversed, and the last plus 1.
~ EOF is a bitwise inverse operation on the EOF, and the value is 00000000. Therefore, the while condition does not meet and the loop ends.
About ~ In A WHILE LOOP ~ Scanf ()