include bios include conio include dos include graphics include math i

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
#include<bios.h>
#include<conio.h>
#include<dos.h>
#include<graphics.h>
#include<math.h>
#include<stdio.h>
#include<stdlib.h>
int arrow_draw(int x, int y, int val, char type)
{
int xa,ya,len,temp;
double angle;
switch(type)
{
case 's':
{
len=80;
angle = (-90+val*6) * M_PI/180;
temp = (int)floor(len*cos(angle));
xa=x+temp;
temp = (int)floor(len*sin(angle));
ya=y+temp;
break;
}
case 'm':
{
len=60;
angle = (-90+val*6) * M_PI/180;
temp = (int)floor(len*cos(angle));
xa=x+temp;
temp = (int)floor(len*sin(angle));
ya=y+temp;
break;
}
case 'h':
{
len=40;
angle = (540 + val*30 + 90) * M_PI/180;
temp = (int)floor(len*cos(angle));
xa=x+temp;
temp = (int)floor(len*sin(angle));
ya=y+temp;
break;
}
}
line(x,y,xa,ya);
return 0;
}
int main(void)
{
int gdriver = DETECT, gmode;
initgraph(&gdriver, &gmode, "e:/subject/bc/bgi");
int midx,midy,rad=100;
midx = getmaxx()/2;
midy = getmaxy()/2;
circle(midx,midy,rad);
int cur_s,cur_m,cur_h,pr_s,pr_m,pr_h;
struct time t;
while(bioskey(1)==0)
{
gettime(&t);
pr_s = cur_s;
pr_m = cur_m;
pr_h = cur_h;
cur_s = t.ti_sec;
cur_m = t.ti_min;
cur_h = t.ti_hour;
gotoxy(1,1);printf("%2d:%2d:%2d\n",cur_h,cur_m,cur_s);
if(pr_h!=cur_h)
{
setcolor(BLACK);
arrow_draw(midx,midy,pr_h,'h');
setcolor(WHITE);
arrow_draw(midx,midy,cur_h,'h');
}
if(pr_m!=cur_m)
{
setcolor(BLACK);
arrow_draw(midx,midy,pr_m,'m');
setcolor(WHITE);
arrow_draw(midx,midy,cur_m,'m');
}
if(pr_s!=cur_s)
{
setcolor(BLACK);
arrow_draw(midx,midy,pr_s,'s');
setcolor(WHITE);
arrow_draw(midx,midy,cur_s,'s');
}
sleep(1);
}
getch();
closegraph();
return 0;
}