+ 1
Is there ways for my program, that can force my program wait maybe 5 sec and only then I can enter with cin>>"" (C++)
2 Antworten
+ 1
#include <iostream>
#include <thread>
#include <chrono>
using namespace std;
int main()
{
cout << "program paused for 5 seconds" << endl;
this_thread::sleep_for (chrono::seconds(5));
cout << "Timer finished";
return 0;
}
+ 3
You can use sleep() function for that
Learn about it here👇
https://www.geeksforgeeks.org/timer-c-using-system-calls/