Analog and Digital clock

Analog and Digital clock

# include <graphics.h>
# include <stdio.h>
# include <dos.h>
# include <string.h>
# include <math.h>
# define pi 3.141592654
int x;
float x30,x60,y30,y60;
void paint1()
{
setcolor(GREEN);
outtextxy(297,60," ");
outtextxy(297,332," ");
outtextxy(435,198," ");
outtextxy(160,198," ");
setcolor(RED);
outtextxy(375,85,"è");
outtextxy(420,260,"è");
outtextxy(170,135,"è");
outtextxy(220,310,"è");
setcolor(LIGHTBLUE);
outtextxy(420,135,"ì");
outtextxy(375,310,"ì");
outtextxy(220,83,"ì");
outtextxy(175,260,"ì");
}
void paint2()
{
setcolor(RED);
outtextxy(297,60,"è");
outtextxy(297,332,"è");
outtextxy(435,198,"è");
outtextxy(160,198,"è");
setcolor(LIGHTBLUE);
outtextxy(375,85,"ì");
outtextxy(420,260,"ì");
outtextxy(170,135,"ì");
outtextxy(220,310,"ì");
setcolor(GREEN);
outtextxy(420,135," ");
outtextxy(375,310," ");
 outtextxy(220,83," ");
outtextxy(175,260," ");
}
void paint3()
{
setcolor(LIGHTBLUE);
outtextxy(297,60,"ì");
outtextxy(297,332,"ì");
outtextxy(435,198,"ì");
outtextxy(160,198,"ì");
setcolor(GREEN);
outtextxy(375,85," ");
outtextxy(420,260," ");
outtextxy(170,135," ");
outtextxy(220,310," ");
setcolor(RED);
outtextxy(420,135,"è");
outtextxy(375,310,"è");
outtextxy(220,83,"è");
outtextxy(175,260,"è");
}
void graph()
{
cleardevice();
setcolor((++x)%15+1);
if(x%2)
outtextxy(180,10,"X");
else
outtextxy(130,20,"X");
setcolor(GREEN);
circle (300,200,150);
circle(300,200,2);
setcolor(14);
circle (300,200,100);
setcolor(3);
circle (300,200,120);
setcolor(RED);
circle(300,50,2);
circle(450,200,2);
 circle(150,200,2);
circle(300,350,2);
setcolor(BLUE);
circle(300+x30,200+y30,2);//1
circle(300-x30,200+y30,2);//11
circle(300+x30,200-y30,2);//5
circle(300-x30,200-y30,2);//7

circle(300+x60,200+y60,2);//2
circle(300+x60,200-y60,2);//4
circle(300-x60,200-y60,2);//8
circle(300-x60,200+y60,2);//10
if(x%2)
{
setcolor(x);
outtextxy(300+x30*1.1,200+y30*1.1,"1");//1
outtextxy(300-x30*1.1,200+y30*1.1,"11");//11
outtextxy(300+x30*1.1,200-y30*1.1,"5");//5
outtextxy(300-x30*1.1,200-y30*1.1,"7");//7

outtextxy(300+x60*1.1,200+y60*1.1,"2");//2
outtextxy(300+x60*1.1,200-y60*1.1,"4");//4
outtextxy(300-x60*1.1,200-y60*1.1,"8");//8
outtextxy(300-x60*1.15,200+y60*1.1,"10");//10
outtextxy(460,200,"3");
outtextxy(300,360,"6");
outtextxy(140,200,"9");
outtextxy(290,40,"12");
}
}

void plot(int h , int m , int s)
{
char a[2],b[2],c[2];
setcolor( LIGHTCYAN );
itoa(h,a,10);
outtextxy(450,100,a);
outtextxy(470,100,":");

itoa(m,a,10);
outtextxy(490,100,a);
outtextxy(510,100,":");

itoa(s,a,10);
outtextxy(530,100,a);
setcolor( LIGHTGREEN );
if( h<13 )
outtextxy( 290 , 250 , "AM");
else
outtextxy( 290 , 250, "PM");
h=h%12;
setlinestyle(SOLID_LINE , 1 , 3);
setcolor( RED );
line(300,200,300+floor(100*cos(((h*5+m/10.0)*6-90)*pi/180)),
    200+floor(100*sin(((h*5+m/10.0)*6-90)*pi/180)));
setcolor(BLUE);
setlinestyle(SOLID_LINE,1,3);
line(300,200,300+floor(120*cos((m*6-90)*pi/180)),
    200+floor(120*sin((m*6-90)*pi/180)));
setcolor(MAGENTA);
setlinestyle(SOLID_LINE,1,1);
line(300,200,300+floor(120*cos((s*6-90)*pi/180)),
    200+floor(120*sin((s*6-90)*pi/180)));
}

void timexy()
{
int h,m,s;
struct time t;
while(1)
{
//clrscr();
  cleardevice();
graph();
gettime(&t);
//printf("


    The current time is:
%2d:%02d:%02d.%02d
",
//       t.ti_hour, t.ti_min, t.ti_sec,t.ti_hund);
h=t.ti_hour;
m=t.ti_min;
s=t.ti_sec;
if(s%3==0)
paint1();
else if(s%3==1)
     paint3();
     else paint2();
plot(h,m,s);
delay(995);
}
}
main()
{
int i=DETECT,m;
char a[100],b[10]="jalpari";
x30=floor(150*cos((30-90)*pi/180));
y30=floor(150*sin((30-90)*pi/180));
x60=floor(150*cos((60-90)*pi/180));
y60=floor(150*sin((60-90)*pi/180));
initgraph(&i,&m,"d:\tc\bgi");
i=0;
printf("
    PASSWORD==>");
do
{
a[i]=getch();
if(!(a[i]==(char)13))
{
printf("vasim");
i++;
}
else {a[i]='


Written by