That is not a good description of the situation.
The lines 32--44 are currently unnecessary. The first character in the input stream that does not convert to integer (it does not have to be |) will set the stream into failed state and thus quit the while loop. Furthermore, a stream in failed state will fail all further input operations.
If you have to quit with '|' and nothing else, then you have three cases:
1. Input is two integers. Handle and ask again. Your while-loop does that.
2. The input failed because next character in the stream is |. Clear stream error, read the character, exit.
3. The input failed because next character in the stream is EOF. No further input is possible. Exit.
4. The input failed because next character in the stream is something else. Clear stream error, remove offending characters, and resume reading integers.