#include #define PI 3.14159265358
int x=320,y=240,r=157,i,r1,r2;
char ch,memo[20];
int h,m,s,d,mon,year,th,tm,ts,secs;
float x1,x2,x3,y1,y2,y3,a;
int count=0;
struct time t;
struct date date;
time_t first,second,third;
void gettandd(void);
void drawpage(void);
void drawplate(void);
void drawhand(int co1,int co2,int co3,float tph,float tpm,float tps);
void showtime(void);
void showdate(void);
void showsound(void);
void setalarm(void);
void alarm(void);
void timeset(void);
int main()
{
int key;
int gd=DETECT,gm=0;
initgraph(&gd,&gm,"");
setbkcolor(BLACK);
gettime(&t);
t.ti_sec=t.ti_sec-1;
h=t.ti_hour;
m=t.ti_min;
s=t.ti_sec;
setwritemode(0);
abc:
while(bioskey(1)==0)
{
first=time(NULL);
gettandd();
drawpage();
drawhand(0,0,0,h-1/3600.0,m-1/60.0,s-1);
drawhand(0,0,0,h-1/3600.0,m-1/60.0,s-1-0.02);
drawhand(0,0,0,h-1/3600.0,m-1/60.0,s-1+0.02);
drawhand(2,1,4,h,m,s);
drawplate();
showtime();
showdate();
showsound();
alarm();
sleep(1);
}
key=bioskey(0);
if(key==0x1e61)
{
setalarm();
goto abc;
}
else if(key==0x1071)
{
count=1;
setcolor(BLUE);
ch='n';
cleardevice();
goto abc;
}
else if(key==0x11b)
;
else if(key==0x1474)
{
timeset();
goto abc;
}
else
goto abc;
closegraph();
nosound();
}
void gettandd()
{
getdate(&date);
s=s+1;
s=s%60;
if(s==0)
m=m+1;
m=m%60;
if(m==0&&s==0)
h=h+1;
if(h>23)
h=0;
year=date.da_year;
mon=date.da_mon;
d=date.da_day;
}
void drawpage(void)
{
line(10,50,10,400);
line(10,50,120,50);
line(120,50,120,400);
line(10,400,120,400);
line(10,80,120,80);
line(520,80,520,350);
line(630,80,630,350);
ellipse(540,140,0,360,20,10);
ellipse(540,180,0,360,20,10);
ellipse(540,220,0,360,20,10);
ellipse(540,260,0,360,20,10);
ellipse(575,350,0,360,55,20);
setlinestyle(SOLID_LINE,0,3);
arc(540,80,90,180,20);
setlinestyle(SOLID_LINE,0,3);
arc(610,80,0,90,20);
setlinestyle(SOLID_LINE,0,3);
line(540,60,610,60);
line(520,85,630,85);
line(10,280,120,280);
line(10,310,120,310);
settextstyle(3,0,2);
setcolor(MAGENTA);
outtextxy(560,62,"help");
setcolor(RED);
outtextxy(525,130,"esc");
outtextxy(535,170,"a");
outtextxy(535,210,"q");
outtextxy(535,250,"t");
setcolor(LIGHTGRAY);
outtextxy(565,130," exit");
outtextxy(565,170,"alarm");
outtextxy(565,210,"quitala");
outtextxy(562,250,"timeset");
setcolor(CYAN);
outtextxy(540,340,"welcome");
}
void drawplate()
{
setcolor(YELLOW);
circle(x,y,1);
setcolor(YELLOW);
circle(x,y,r);
circle(x,y,r+2);
for (i=1;i<=60;i++)
{
a=i*PI/30.0;
r1=r;
r2=r-4;
if (i%5==0)
r2=r2-5;
x1=x+r1*sin(a);
y1=y-r1*cos(a);
x2=x