xxxxxxxxxx
#if __WIN32
#include <Windows.h>
#else
#include <unistd.h>
#endif
xxxxxxxxxx
// to use sleep function on windows with c++
#include <Windows.h>
Sleep(3000) // based on milliseconds
xxxxxxxxxx
#include <unistd.h>
using namespace std;
int main() {
cout << "Time sleep"
sleep(10)
return 0;
}
xxxxxxxxxx
#include <iostream>
#include <windows.h> // WinApi header
using namespace std;
int main()
{
Beep(523,500); // 523 hertz (C5) for 500 milliseconds
cin.get(); // wait
return 0;
}