What I don't understand is how cin knows to move to the next character. Is it that the first cin only stores 1 character (as char can only hold one) so whenever cin is repeated it reads the rest in the input stream?
while the character is not equal to #
print out the character that was inputted
get input back in to ch from the user
The cin statement within the while loop will change the 'ch' variable to the new user input and then check it again to see whether ot not it is equal to # before deciding what to do.
Yes, every time the expression "cin >> ch" is evaluated, it reads (and stores in ch) the next character from the standard input stream, unless the stream has received the end-of-input sequence.
Note that the program will enter an endless loop if end-of-input happens (try entering Ctrl-D on Linux or Ctrl-Z on Windows)
That endless loop as well as some code repetition could be avoided with a for-loop: