Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ctime>
- #include <iostream>
- using namespace std;
- #define CTRL_TIME 4
- bool minuteur (double begin, double end,double ctrl){
- double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC;
- if (ctrl <elapsed_secs){return true;}
- return false;
- }
- void chronometre(double begin, double end) {
- double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC;
- cout <<elapsed_secs<<endl;
- }
- int main (){
- clock_t begin = clock();//Obtient l'heure initiale
- clock_t end = clock();
- while (true){
- end = clock();//Obtient l'heure actuelle
- chronometre (begin, end);
- if (minuteur(begin, end,CTRL_TIME)){return -1;}
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement