- #include <iostream.h>
- #include <stdlib.h>
- #include <time.h>
- #include <conio.c>
- #include <math.h>
-
- void cercle(float angle,float rayon)
- {
- //place le curseur en fonction de la distance et l'angle.le centre est a point(40;13)
- gotoxy(40+(sin(angle)*rayon)*2,13-(cos(angle)*rayon));
- }
-
-
- void montre(int h,int m,int s)//affiche l'horloge
- {
- system("cls");
- cout<<h<<":"<<m<<" "<<s<<"'";
- textcolor(15);
- for(float x=0;x<=6.283;x+=0.02)//affiche le contour
- {
- cercle(x,12);
- cout<<(char)46;
- }
- textcolor(228);
- for(int x=1;x<=12;x++){ //affiche les nombres des heures
- cercle(x*(float)0.5236,11);
- cout<<x; }
- textcolor(68);
- for(float x=0;x<=6;x+=0.5)//affiche l'aiguille des heure
- {
- cercle((float)(h)/12*6.283,x);
- cout<<(char)219;
- }
- textcolor(154);
- for(float x=0;x<=9;x+=0.5)//puis celle des minuttes
- {
- cercle((float)(m)/60*6.283,x);
- cout<<(char)177;
- }
- textcolor(47); //et enfin un 's' pour les secondes
- cercle((float)(s)/60*6.283,9);
- cout<<"s";
-
-
-
-
-
-
-
- }
-
- int main()
- {
- int c,h,m,s;
-
- while(1)
- {
- c = time(0);
- c=c-1068332459;//le nombre est ici un temp ou il etait minuit
- c=c%86400; //86400 s en 1 jour
- h=c/3600;
- m=(c-(h*3600))/60;
- s=c%60;
- montre(h,m,s);
- Sleep(5000);//pause de 5 sec
- }
-
- }
#include <iostream.h>
#include <stdlib.h>
#include <time.h>
#include <conio.c>
#include <math.h>
void cercle(float angle,float rayon)
{
//place le curseur en fonction de la distance et l'angle.le centre est a point(40;13)
gotoxy(40+(sin(angle)*rayon)*2,13-(cos(angle)*rayon));
}
void montre(int h,int m,int s)//affiche l'horloge
{
system("cls");
cout<<h<<":"<<m<<" "<<s<<"'";
textcolor(15);
for(float x=0;x<=6.283;x+=0.02)//affiche le contour
{
cercle(x,12);
cout<<(char)46;
}
textcolor(228);
for(int x=1;x<=12;x++){ //affiche les nombres des heures
cercle(x*(float)0.5236,11);
cout<<x; }
textcolor(68);
for(float x=0;x<=6;x+=0.5)//affiche l'aiguille des heure
{
cercle((float)(h)/12*6.283,x);
cout<<(char)219;
}
textcolor(154);
for(float x=0;x<=9;x+=0.5)//puis celle des minuttes
{
cercle((float)(m)/60*6.283,x);
cout<<(char)177;
}
textcolor(47); //et enfin un 's' pour les secondes
cercle((float)(s)/60*6.283,9);
cout<<"s";
}
int main()
{
int c,h,m,s;
while(1)
{
c = time(0);
c=c-1068332459;//le nombre est ici un temp ou il etait minuit
c=c%86400; //86400 s en 1 jour
h=c/3600;
m=(c-(h*3600))/60;
s=c%60;
montre(h,m,s);
Sleep(5000);//pause de 5 sec
}
}