eg0rmaffin

Электронные часы формата h:mm:ss без использования if

Jun 26th, 2019
390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int
  4. main ()
  5. {
  6.   int sec, min, h, d;
  7.   cin >> sec;
  8.   cout << ((sec % 86400) / 3600) << ":" << (((sec % 86400) % 3600) / 60) / 10;
  9.   cout << (((sec % 86400) % 3600) / 60) % 10 << ":";
  10.   cout << (((sec % 86400) % 3600) % 60) / 10;
  11.   cout << (((sec % 86400) % 3600) % 60) % 10;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment