18 lines
646 B
C++
18 lines
646 B
C++
|
# include <iostream>
|
||
|
# include <cmath>
|
||
|
using namespace std;
|
||
|
long convt = 60;
|
||
|
long convd = 24;
|
||
|
int main(){
|
||
|
long time_all;
|
||
|
cout << "Enter the number of seconds: ";
|
||
|
cin >> time_all;
|
||
|
int day, hour, minute, second;
|
||
|
day = time_all / pow(convt,2) / convd;
|
||
|
hour = (time_all - day * pow(convt,2) * convd)/ pow(convt,2);
|
||
|
minute = (time_all - day * pow(convt,2) * convd - hour * pow(convt,2)) / pow (convt,1);
|
||
|
second = time_all - day * pow(convt,2) * convd - hour * pow(convt,2) - minute * pow (convt,1);
|
||
|
cout << time_all << " secods = " << day << " days, " << hour << " hours, " << minute << " minutes, " << second << " seoncds\n";
|
||
|
return 0;
|
||
|
}
|