This code is written in C++ and for reasons that I don\'t quite understand it is written twice.
I would expect that after inputting a random char it would display the char once
You forgot about the newline.
cin reads every character, which includes the newline you type after typing your character.
If you don't want this behaviour, you have to specifically check for newline.
while (letter!= 'X')
{
if (letter == '\n')
{
letter = cin.get();
continue;
}
cout<