mirror of
https://codeberg.org/DansLeRuSH/c-plus-plus-exercises.git
synced 2024-12-03 15:42:12 +00:00
Display the time
This commit is contained in:
parent
2bfab43c8f
commit
9364306655
1 changed files with 40 additions and 0 deletions
40
EX12_afficher_heure.cpp
Normal file
40
EX12_afficher_heure.cpp
Normal file
|
@ -0,0 +1,40 @@
|
|||
// Auteur : Franck ALBARET
|
||||
#include <stdio.h>
|
||||
|
||||
void compteur (int hh, int mm, int ss)
|
||||
{
|
||||
ss=ss+1;
|
||||
if (ss>59)
|
||||
{
|
||||
ss=0;
|
||||
mm=mm+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ss=ss+1;
|
||||
}
|
||||
if (mm>59)
|
||||
{
|
||||
mm=0;
|
||||
hh=hh+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mm=mm+1;
|
||||
}
|
||||
if (hh>23)
|
||||
{
|
||||
hh=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
hh=hh+1;
|
||||
}
|
||||
printf ("L'heure actuelle est %02i:%02i:%02i\n",hh,mm,ss);
|
||||
}
|
||||
|
||||
int main (void)
|
||||
{
|
||||
compteur (23,59,59);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue