#include <iostream>
#include <windows.h>
#include <ctime>
using namespace std;
double time1;
int main()
{
const double seconds1 = time(0);
string string1;
while(1)
{
long double seconds2 = time(0);
if(seconds2 == seconds1 + 5)
{ cout << "Five seconds went by.\n\n"; break; }
}
cin.clear();
cin.ignore(255, '\n');
cin.get();
return 0;
}
^ This outputs "Five seconds went by." after five seconds. Is there a way to throw in some sort of input so that the program can prompt the user for input and after five seconds say something like 'too late' and close? Or would I have to go about timing in a totally different way?