Delay execution 1 second

后端 未结 4 475
青春惊慌失措
青春惊慌失措 2020-12-20 23:51

So I am trying to program a simple tick-based game. I write in C++ on a linux machine. The code below illustrates what I\'m trying to accomplish.

for (unsign         


        
4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-21 00:37

    To reiterate on what has already been stated by others with a concrete example:

    Assuming you're using std::cout for output, you should call std::cout.flush(); right before the sleep command. See this MS knowledgebase article.

提交回复
热议问题