Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#include <iostream>
#include <ctime>
#include <unistd.h>
using namespace std;
int timer()
{
/*The while loop should run for 5 mins(300 secs).
time(0) gives the current time, because we are using the library ctime.*/
int total_time = 300;
time_t current_time = time(0);
while(time(0)-current_time<total_time)
{
//Suppose to execute the main file.
}
cout<<"Game Over, Your time is up!!!";
}