When I type some character this program prints a single message. When I type two characters it prints hello world
twice and when aaaaa
is typed, five hello world
messages are printed and so on! Why?
int _tmain(int argc, _TCHAR* argv[])
{
char nnn;
do {
cout << "hello world" << endl;
cin >> nnn;
} while ((nnn != 'y'));
return 0;
}
Here's a result:
hello world
d
hello world
ffff
hello world
hello world
hello world
hello world
y