There are 2 codes that I want to know the difference between them.
I still cannot understand if swapping the getting input command is going
to affect the code or not.
On the first program, the user enters 'x' at cin >> ch, and then it will do the else statement (lines 31-33), and print Invalid operation.
On the second program, the user enters 'x' at cin >> ch, and it will check the while loop condition before looping again, and so the loop will end before "Invalid operation" is ever printed.