DEV/DEV1.1/TP13/rebour.c

30 lines
598 B
C

#include <graph.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <unistd.h>
int main(int argc, char const *argv[])
{
int min;
int heure;
printf("rentrez une heure (format: hh mm):\n");
scanf("%d %d",&heure,&min);
InitialiserGraphique();
CreerFenetre(10,10,130,38);
time_t t = time(NULL);
struct tm tm = *localtime(&t);
char tab[8];
couleur c=CouleurParNom("white");
while(5!=0)
{
EffacerEcran(c);
t = time(NULL);
tm = *localtime(&t);
sprintf(tab,"%02d:%02d:%02d",heure-tm.tm_hour,min-tm.tm_min,60-tm.tm_sec);
EcrireTexte(10,30,tab,2);
sleep(1);
}
}