#include struct horaire { int heure; int minute; int seconde; }; void afficherHoraire(struct horaire h) { printf("%02d:%02d:%02d", h.heure, h.minute, h.seconde); } int calculerSecondes(struct horaire h) { return h.heure * 3600 + h.minute * 60 + h.seconde; } struct horaire calculerHoraire(int secondes) { struct horaire h = { secondes / 3600,(secondes / 60) % 60,secondes % 60 }; return h; } struct horaire calculerHoraireSecondeSuivante(struct horaire h) { struct horaire nh = h; nh.seconde++; if (nh.seconde == 60) { nh.seconde = 0; nh.minute++; if (nh.minute == 60) { nh.minute = 0; nh.heure++; if (nh.heure == 24) { nh.heure = 0; } } } return nh; } void main(void) { int s = 53227; struct horaire h = calculerHoraire(s); printf("%d secondes = ", s); afficherHoraire(h); printf("\n"); struct horaire h2 = calculerHoraireSecondeSuivante(h); afficherHoraire(h2); printf("\n"); h2 = calculerHoraireSecondeSuivante(h2); afficherHoraire(h2); printf("\n"); }