1#include <chrono>
2#include <thread>
3
4std::this_thread::sleep_for(std::chrono::milliseconds(x));
1#include <iostream> //for using cout
2#include <Windows.h> //for using the function Sleep
3
4using namespace std; //for using cout
5
6int main(void)
7{
8 cout << "test" << endl;
9 Sleep(5000); //make the programme waiting for 5 seconds
10 cout << "test" << endl;
11 Sleep(2000); // wait for 2 seconds before closing
12
13 return 0;
14}
15
1// to use sleep function on windows with c++
2#include <Windows.h>
3Sleep(3000) // based on milliseconds