ساعت analog به زبان c++ جالبه حتما استفاده كنيد

#include<stdio.h>
#include<graphics.h>
#include<math.h>
#include<dos.h>

void main()
{
int midx,midy,sec_x[60],sec_y[60],xcord[720],ycord[720],rad=130;
int min_x[720],min_y[720],hour_x[720],hour_y[720],a,b,c;
int gd=DETECT,gm,m,n,h,i;
char ch;
float j;
double ang;
struct time t;

initgraph(&gd,&gm,"c:\\tc\\bgi");
midx=getmaxx()/2;
midy=getmaxy()/2;
setcolor(DARKGRAY);
circle(midx,midy,rad+40);
setcolor(LIGHTGRAY);
circle(midx,midy,rad+39);
setcolor(WHITE);
circle(midx,midy,rad+38);
setcolor(LIGHTGRAY);
circle(midx,midy,rad+37);
setcolor(DARKGRAY);
circle(midx,midy,rad+36);
setcolor(DARKGRAY);
setfillstyle(SOLID_FILL,BLACK);
circle(midx,midy,rad+5);
floodfill(midx,midy,DARKGRAY);
setcolor(RED);
outtextxy(midx-8,midy-152 ,"12");
outtextxy(midx+146,midy-3,"3");
outtextxy(midx-3,midy+148 ,"6");
outtextxy(midx-150,midy-3,"9");

for(i=0;i<360;i++)
{
if(i%6==0)
{
ang=(double)i*3.14/180;
xcord[0]=(int)(rad+8)*cos(ang);
ycord[0]=(int)(rad+8)*sin(ang);
putpixel(midx+xcord[0],midy+ycord[0],YELLOW);
}
if(i%30==0)
{
ang=(double)i*3.14/180;
xcord[1]=(int)(rad+12)*cos(ang);
ycord[1]=(int)(rad+12)*sin(ang);
setcolor(RED);
setlinestyle(SOLID_LINE,1,3);
line(midx+xcord[0],midy+ycord[0],midx+xcord[1],midy+ycord[1]);
}
}
/* for second hand */
m=0;
for(i=0;i<360;i++)
{
if(i%6==0)
{
ang=(double)i*3.14/180;
xcord[m]=(int)rad*cos(ang);
ycord[m]=(int)rad*sin(ang);
m++;
}
}
m=0;
for(i=45;i<60;i++)
{
sec_x[m]=xcord[i];
sec_y[m]=ycord[i];
m++;
}
for(i=0;i<45;i++)
{
sec_x[m]=xcord[i];
sec_y[m]=ycord[i];
m++;
}
/* for minute hand*/
m=0;
j=0.0;
for(i=0;i<720;i++)
{
ang=(double)j*3.14/180;
xcord[m]=(int)(rad)*cos(ang);
ycord[m]=(int)(rad)*sin(ang);
m++;
j=j+0.5;
}
m=0;
for(i=540;i<720;i++)
{
min_x[m]=xcord[i];
min_y[m]=ycord[i];
m++;
}
for(i=0;i<540;i++)
{
min_x[m]=xcord[i];
min_y[m]=ycord[i];
m++;
}
/* for hour hand */
m=0;
j=0.0;
for(i=0;i<720;i++)
{
ang=(double)j*3.14/180;
xcord[m]=(int)(rad-50)*cos(ang);
ycord[m]=(int)(rad-50)*sin(ang);
m++;
j=j+0.5;
}
m=0;
for(i=540;i<720;i++)
{
hour_x[m]=xcord[i];
hour_y[m]=ycord[i];
m++;
}
for(i=0;i<540;i++)
{
hour_x[m]=xcord[i];
hour_y[m]=ycord[i];
m++;
}

/* Display watch hand */
gettime(&t);
i=t.ti_sec;
n=t.ti_min*12;
h=(t.ti_hour*60+t.ti_min)%720;
while(ch!=27)
{
while(kbhit())
{
ch=getch();
}
setcolor(YELLOW);
settextstyle(1,HORIZ_DIR, 1);
outtextxy(midx-50,midy+40,"Vikas Togre");
settextstyle(1,HORIZ_DIR, 1);
outtextxy(midx-50,midy+60,"Nitin Shelke");

setcolor(RED);
setlinestyle(SOLID_LINE,1,3);
line(midx,midy,midx+hour_x[h],midy+hour_y[h]); //show hour hand
setcolor(YELLOW);
setlinestyle(SOLID_LINE,1,2);
line(midx,midy,midx+min_x[n],midy+min_y[n]); //Show minute hand
setcolor(GREEN);
setlinestyle(SOLID_LINE,1,1);
line(midx,midy,midx+sec_x[i],midy+sec_y[i]); //show second hand
delay(1000);
setcolor(BLACK);
setlinestyle(SOLID_LINE,1,3);
line(midx,midy,midx+hour_x[h],midy+hour_y[h]); //Hide hour hand
setlinestyle(SOLID_LINE,1,2);
line(midx,midy,midx+min_x[n],midy+min_y[n]); //Hide minute hand
setlinestyle(SOLID_LINE,1,1);
line(midx,midy,midx+sec_x[i],midy+sec_y[i]); //Hide second hand
i++;
a=i%5;
if(a==0)
{
n++;
if(n==720)
{
n=0;
}
}
if(i==60)
{
i=0;
h++;
if(h==720)
{
h=0;
}
}

}
closegraph();
}