From 4156f1f4307007f7a0561af81aedc576f6f4be0c Mon Sep 17 00:00:00 2001 From: Balentins Date: Tue, 13 Dec 2016 09:44:26 +0100 Subject: [PATCH] programme heure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit les varible d'eure minute et seconde ne se stock pas dans des différentes variables --- heure | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 heure diff --git a/heure b/heure new file mode 100644 index 0000000..5a9c247 --- /dev/null +++ b/heure @@ -0,0 +1,59 @@ +#include +#include +#include + + +int main() + +{ + int h=0; + int m=0; + int s=0; + +while(1) + { + time_t secondes; + + struct tm instant; + + + time(&secondes); + + instant=*localtime(&secondes); + h==instant.tm_hour; + m==instant.tm_min; + s==instant.tm_sec; + if (instant.tm_hour>12) + { + printf("c'est l'apres midi \n"); + } + if (instant.tm_hour<12) + { + printf("c'est le matin \n"); + } + if (instant.tm_min>38) + { + printf("deuxieme moitié de minute \n"); + } + if (instant.tm_min<38) + { + printf("première moitié de minute \n"); + } + if (instant.tm_sec>30) + { + printf("deiuxieme moitié de minute \n"); + } + if (instant.tm_sec<30) + { + printf("première moitié de seconde \n"); + } + + + printf("%d:%d:%d\n", instant.tm_hour, instant.tm_min, instant.tm_sec); + sleep(1); + system ("clear"); + + } + return 0; + +}