[求助]关于函数调用的问题
这是一个闹钟的程序,编译时报错,说aclock,tick这2个函数没有声明,但是我明明声明的的啊。我换在vc环境下,关于函数的调用又没有报错,这是为什么啊?
# include <stdio.h>
# include <stdlib.h>
# include <conio.h>
# include<graphics.h>
# include<time.h>
# include<math.h>
# define pi 3.1415
void main()
{
int xyc[2],r[2],alpha[2],delta;
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"d:\\tc\\BGI");
setbkcolor(WHITE);
setwritemode(1);
srand(time(NULL));
xyc[0]=250;
xyc[1]=200;
setcolor(DARKGRAY);
aclock(xyc);/*要调用的函数*/
getch();
closegraph();
}
void aclock(int xyc[2])
{
int i,r,x1,y1,x2,y2;
int hs,ms,ha,ma,sa;
double x,y,ang,theta,cosn,sinn;
struct tm*t;
time_t st,et,t1,t2;
char *clk[12]={"1","2","3","4","5","6","7","8","9","10","11","12"};
circle(xyc[0],xyc[1],150);
circle(xyc[0],xyc[1],100);
ang=pi/3.0;
theta=pi/6.0;
r=125;
for(i=0;i<12;i++)
{
cosn=cos(ang);
sinn=sin(ang);
x=r*cosn;
y=r*sinn;
x1=xyc[0]+x;
y1=xyc[1]-y;
outtextxy(x1,y1,clk[i]);
ang=ang-theta;
}
t=gmtime(&st);
i=t->tm_sec;
sa=i*6;
i=t->tm_min;
ma=i*6;
ha=i/2;
i=t->tm_hour;
i=i%12;
ha=i*30+ha;
tick(xyc,40,ha);
tick(xyc,60,ma);
tick(xyc,90,sa);
st=time(NULL);
et=st;
t1=st;
t2=st;
while((et-st)<60L)
{
if((t2-t1)>=1L)
{
/*secondhand*/
tick(xyc,90,sa);
sa=sa+6;
if(sa>360)
{
sa=sa-360;
}
tick(xyc,90,sa);
/*minhand*/
ms=ms+1;
if(ms>=10)
{
ms=0;
tick(xyc,60,ma);
ma=ma+1;
if(ma>360)
{
ma=ma-360;
}
tick(xyc,60,ma);
}
/*hourhand*/
hs=hs+1;
if(hs>=120)
{
hs=0;
tick(xyc,40,ha);
ha=ha+1;
if(ha>360)
{
ha=ha-360;
}
tick(xyc,40,ha);
}
}
t1=t2;
et=time(NULL);
t2=et;
}
}
/*refresh*/
void tick(int xyc[2],int r,int alpha)
{
int x1,y1,x2,y2;
double x,y,ang,cosn,sinn;
/*draw new hand*/
ang=pi*(90-alpha)/180.0;
cosn=cos(ang);
sinn=sin(ang);
x1=xyc[0];
y1=xyc[1];
x=r*cosn;
y=r*sinn;
x2=xyc[0]+x;
y2=xyc[1]-y;
line(x1,y1,x2,y2);
}