Code will check whether the number entered is integer or not.
ignore extracts characters from the input sequence and discards them. The extraction ends when max characters have been extracted and discarded or when the character delim(\n) is found, whichever comes first.
In the latter case, the delim character itself is also extracted.
numeric_limits<int>::max() - Returns the maximum finite value for integer.
gcount - returns the number of characters extracted by the last unformatted input operation performed on the object.