I have a code as shown below for a Quiz program for which I need to add a time limit. The code is currently evaluating the quiz based on the time used. But I want it to go out after 5 minutes exactly from the moment the program starts.
Header used
#include<time.h>
Initialized values as follows
time_t initialtime,finaltime;
I am starting the countdown to the quiz using this code
initialtime=time(NULL);
When the program ends, I get time using this code
finaltime=time(NULL);
Now, how do I end a program before a final time of up to 10 minutes? What code should be used in the main function?
PS: I can post the full code if necessary.
source share