char key = '0';
while(key != 'x')
{
cout << key;
key = _getchar();
}
Whenever I run this code, key comes up as some question mark inside of a square. Why?
I think you mean _getch() or getchar() (without underscore). Also, I don't think it's a good idea to use conio.h, it is deprecated. Your code works fine for me ( with _getch() ), but if it still shows squares as you said, this should be because you output unicode to a ASCII stream, so try this instead: