Permalink
Cannot retrieve contributors at this time
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?
Team-Froggies-4007CEM/timer.h
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
16 lines (16 sloc)
409 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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!!!"; | |
} |