Cout in loop doesn't print char by char as defined
问题 I've recently started learning C++ at university and decided to advance a bit at home. I had the idea of making a program that, given a piece of text, would print out such text character by character with a small delay in-between (as seen in this video SUPER.HOT chat). I tried to recreate it using a simple procedure: void typer(string text){ for (int i = 0; i < text.length(); i++){ cout << text[i]; usleep(100000); } But when usleep() is set under 103900, it'll start printing out two