#include <iostream>
/*
*We use the fact that the result of division operations for an integer is an integer
*/
void GetTime(int s) {
std::cerr << s / 3600 << ":" << (s - (s / 3600) * 3600) / 60 <<
":" << (s - (s / 3600) * 3600 - ((s - (s / 3600) * 3600) / 60) * 60);
}
int main() {
int seconds;
std::cerr << "Enter the elapsed time in seconds ";
std::cin >> seconds;
GetTime(seconds);
}
Comments
Leave a comment