U
U
user2687042020-06-25 19:39:24
C++ / C#
user268704, 2020-06-25 19:39:24

How to wait a while in c++ and then perform some action?

To complete the task, you must wait one second and then subtract the value from the variable, looking for the answer to the question, and found only

#include <windows.h>
int main() {
Sleep(5000);
};

But my compiler swears, here 5ef4d2ff8187c522690326.png
Help please.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Ananiev, 2020-06-25
@user268704

Use std::this_thread::sleep_for
https://en.cppreference.com/w/cpp/thread/sleep_for

C
casoer, 2020-06-25
@casoer

zhmyak

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question