0
#include<stdio.h>
int main()
{ int n=3;
while(n>0)
{ printf("P");
n--;
sleep(1);
}
return 0;
}
このコードでは、3秒後に3つのPが同時に表示されます。しかし、私はそれを1秒の時間間隔で1つずつ表示したい。どのように修正する必要がありますか?sleep()を使用して少し遅れて文字を出力する
の可能な複製を[私のprintf()の前にsleep()が実行されるのはなぜですか?](http://stackoverflow.com/questions/338273/why-does-sleep-execute-before-my-printf-the-opposite -order-of-my-code) – indiv