Greetings!
I had trouble understanding what exactly (!cin) and (op!='x') signify in this code. From my understanding, it is some sort of boolean, but in the context of this code, I don't quite understand what it is doing, and what the condition is for providing no operand.
if (!cin)
If statements take a bool value. If something other than a bool is passed it must be converted to bool. When a stream such as std::cin is converted to a bool. The result is false if the stream is in a fail state or true if the stream is not in a fail state.
A stream will be placed in a fail state when input fails. One reason input might fail is when you try to input a char into an integer.