Yes, it is caused by the return character.To ignore the return character, you can add the following line in you code before input.
cin.ignore();
This line is to remove the return character from the std input stream.
I happened to have tried this today.
Any comment is welcome.
why fflush(stdio) cannot work??