Basic program, you have to press a key, and if the key is for example 'a', the program inputs "LOL", or smth like that, I hope you understand what I mean. The problem is that the program does not do things like it should.
I press x for 3 tiem and the program does nothing, and when I press enter(ASCII value=13) the program inputs "LOL" for three time.
q:Why doesnt the program inputs the "LOL" immediately?
cout is buffered. That is, it may not generate output immediately. Why? Because if you're sending a lot of output, it's more efficient to do it that way.
You can force the stream to flush it's contents by calling the flush method. However, writing an end of line with endl also calls flush, as that seems like a reasonable time to do it.