一个桌面闹钟源程序 /*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/
/*############### CLOCK.C ###############*/
/*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <dos.h>
#include <math.h>
#define X(a,b,c) x=a*cos(b*c*pi/180.0-pi/2)+midx;
#define Y(a,b,c) y=a*sin(b*c*pi/180.0-pi/2)+midy;
#define d(a,b,c) X(a,b,c);Y(a,b,c);line(midx,midy,x,y)
#define pi 3.1415926
void main(void)
{
float x,y;
int gdriver = DETECT, gmode, errorcode;
int midx, midy,l,x1,x2,y1,y2;
int radius = 100;
struct time t;
float h,m,s;
int i;
/* initialize graphics */
initgraph(&gdriver, &gmode, " ");
/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error: %s", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* terminate with an error code */
}
setwritemode(1); /*she zhi wei fu gai xing shi,zuo yong shi*/
/* mei hua yi ci xian jiou qing chu yi ci*/
/*yi xia shi de dao yuan xi zuo biao */
midx = getmaxx() / 2;
midy = getmaxy() / 2;
setbkcolor(1); /*bei jing yan se wei BLUE*/
setcolor(2); /*she zhi li mian circle de color*/