The if-statement tests whethter the reading of the variable number did succeed.
If cin did read something other than an integer, cin will be false. So !cin will become true.
The same for cin.gcount()
The cin.ignore() or the if statement?
For the cin.ignore(), that ignores everything the user puts in up to an endline. Good for pausing, if you can remember what it says.