-
Notifications
You must be signed in to change notification settings - Fork 0
/
main2.cpp
56 lines (51 loc) · 1.46 KB
/
main2.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
#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' or resp=='s' ){
cout << "Alarma hora: ";
cin >> alarma_hrs;
cout << "Alarma minutos: ";
cin >> alarma_min;
cout << "Alarma segundos: ";
cin >> alarma_sec;
for (hrs = 0; hrs < 23; ++hrs) {
for (min = 0; min < 60; ++min) {
for (sec = 0; sec < 60; ++sec) {
cout << hrs << ":" << min << ":" << sec << endl;
Sleep(1000);
if (hrs == alarma_hrs && min==alarma_min && sec==alarma_sec){
cout << "Tiempo terminado" <<endl;
return 0;
}
}
}
}
}else{
for (hrs = 0; hrs < 23; ++hrs) {
for (min = 0; min < 60; ++min) {
for (sec = 0; sec < 60; ++sec) {
cout << hrs << ":" << min << ":" << sec << endl;
//Sleep(1000);
}
if (hrs == 23 && min==60 && sec==60){
hrs =0;
min = 0;
sec = 0;
}
}
}
}
return 0;
}