-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathformato_tiempo.cpp
48 lines (38 loc) · 945 Bytes
/
formato_tiempo.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
/**
* @file formato_tiempo.cpp
* @brief Segundos a formato legible (Ej. 1.14)
*
* @author Akram-Hamdouchi
* @date 29-Septiembre-2021
*
* Escriba un programa C++ que lea un entero, correspondiente a una cantidad de
* segundos, y escriba en la salida est�ndar el n�mero de d�as, horas, minutos
* y segundos que le corresponden. El n�mero de horas debe ser menor que 24, y
* el de minutos y segundos menor que 60.
*
*/
#include <iostream>
using namespace std;
int main () {
int entero;
cout << "Indique el número de segundos: ";
cin >> entero;
int seg;
seg = (entero%60);
cout << seg << " segundos" << endl;
int min;
min = (entero/60);
int x;
x = min%60;
cout << x << " minutos" << endl;
int hours;
hours = (min/60);
int y;
y = (hours%24);
cout << y << " horas" << endl;
int days;
days = (hours / 24);
int z;
cout << days << " días." << endl;
return 0;
}