Advertisement
Sta99ot

Untitled

Apr 4th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. using namespace std;
  4. int main() {
  5. int x;
  6. cin » x;
  7. int h = x / 3600, m = x / 60 % 60, s = x % 60 ;
  8.  
  9. if (h < 24) { //вводим цикл1 (часов)
  10. cout « h « ":";
  11. }
  12. else { //если часов > 23, то пишем 0
  13. cout « "0:";
  14. } //конец цикла1
  15.  
  16. if (m < 10) {
  17. cout « "0" « m;
  18. }
  19. else if (9 < m < 60) {  // <- смотреть сюда
  20. cout « m;
  21. }
  22. else {
  23. cout « "00";
  24. }
  25.  
  26. if (s < 10) {
  27. cout « ":0" « s;
  28. }
  29. else if (9 < s < 60) { // < и сюда
  30. cout « ":" « s;
  31. }
  32. else {
  33. cout « ":00";
  34. }
  35.  
  36.  
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement