Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- int main() {
- int x;
- cin » x;
- int h = x / 3600, m = x / 60 % 60, s = x % 60 ;
- if (h < 24) { //вводим цикл1 (часов)
- cout « h « ":";
- }
- else { //если часов > 23, то пишем 0
- cout « "0:";
- } //конец цикла1
- if (m < 10) {
- cout « "0" « m;
- }
- else if (9 < m < 60) { // <- смотреть сюда
- cout « m;
- }
- else {
- cout « "00";
- }
- if (s < 10) {
- cout « ":0" « s;
- }
- else if (9 < s < 60) { // < и сюда
- cout « ":" « s;
- }
- else {
- cout « ":00";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement