-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimer.cpp
More file actions
54 lines (48 loc) · 1.09 KB
/
timer.cpp
File metadata and controls
54 lines (48 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <iostream>
#include <conio.h>
#include <stdlib.h>
#include <time.h>
#include <thread>//necesario
#include <chrono>//necesario
using namespace std;
using namespace std::this_thread;//sleep for//hacer que el programa duerma por una cantidad de tiempo
using namespace std::chrono;
int main (){
int s=0;
int m=0;
int h=0;
cout<<"Seleccione las horas, minutos y segundos\n";
getch();
system ("cls");
cout<<"Horas:\n";
cin>>h;
system ("cls");
cout<<"minutos:\n";
cin>>m;
system ("cls");
cout<<"segundos:\n";
cin>>s;
while(1==1){
system ("cls");
cout<<h<<":"<<m<<":"<<s;
sleep_for (seconds(1));//sleep for (min, seconds,hours(tiempo))
s--;
if (m==0 && s==0){
if(h==0 && m==0 && s==0){
break;
}
h--;
m=59;
s=60;
}
if(s==0) {
m--;
s=60;
}
if(h==0 && m==0 && s==0){
break;
}
}
system("cls");
cout<<"Se acabo el tiempo ";
}