-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
78 lines (71 loc) · 1.79 KB
/
main.cpp
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include <iostream>
#include <cstdlib>
#include <Windows.h>
using namespace std;
int main() {
int hrs = 0;
int min = 0;
int sec = 0;
int alarma_hrs;
int alarma_min;
int alarma_sec;
char resp;
cout << "Iniciando reloj" << endl;
cout << "Establecer alarma? S/N" << endl;
cin >> resp;
if (resp=='S' || resp=='s' ){
cout << "Alarma hora: ";
cin >> alarma_hrs;
cout << "Alarma minutos: ";
cin >> alarma_min;
cout << "Alarma segundos: ";
cin >> alarma_sec;
while(hrs<=23) {
system("cls");
cout<<hrs<<":"<<min<<":"<<sec<<endl;
sec++;
if (sec>=60)
{
min++;
sec=0;
}
if (min>=60)
{
hrs++;
min=0;
}
if (hrs == 23 && min==60 && sec==60){
hrs =0;
min = 0;
sec = 0;
}
if (hrs == alarma_hrs && min==alarma_min && sec==alarma_sec){
cout << "Tiempo terminado" <<endl;
return 0;
}
}
}else{
while(hrs<=23) {
system("cls");
cout<<hrs<<":"<<min<<":"<<sec<<endl;
sec++;
//Sleep(1000);
if (sec>=60)
{
min++;
sec=0;
}
if (min>=60)
{
hrs++;
min=0;
}
if (hrs == 23 && min==60 && sec==60){
hrs =0;
min = 0;
sec = 0;
}
}
}
return 0;
}