Because errorneous input is still in input buffer.
How is that works:
<Output line Enter your PIN Number --> >
Try to read int;
Hm, input buffer is empty. Request user for input;
<inputted "11">
reading 1... OK, removing it from buffer
reading 1... OK, removing it from buffer
FINISHED. Your number is 11!
Other possibility:
...
<inputted "dd">
reading d... Wait it is not a digit
ACHTUNG!!! Set failed state!!! Stop Processing!!
check if state is failed... true
clear error state.
<Output line Enter your PIN Number --> >
Try to read int;
There are still input in buffer. Read it first.
reading d... Wait it is not a digit
ACHTUNG!!! Set failed state!!! Stop Processing!!
check if state is failed... true
......... etc.
Use std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n') after ignore