[求助]为什么我这个程序运行时每隔几秒屏幕会花啊?该改什么地方啊?
# include <stdio.h><br># include <stdlib.h><br># include <conio.h><br># include<graphics.h><br># include<dos.h><br># include<math.h><br># include<complex.h><br># define pi 3.1415<br>void drawshizhen(int a) ;<br>void drawfenzhen(int b) ;<br>void drawmiaozhen(int c) ;<br><br><br>void main()<br>{<br>int gdriver=DETECT,gmode;<br>initgraph(&gdriver,&gmode,"d:\\tc\\BGI");<br>//cleardevice();<br><br><br>while(!kbhit()){<br>setwritemode(1);<br>srand(time(NULL));<br><br>int j;<br>struct time t;<br>gettime(&t);<br>printf("The current time is: %2d:%02d:%02d.%02d\n",t.ti_hour, t.ti_min, t.ti_sec, t.ti_hund);<br>gotoxy(0,0);<br><br><br>setcolor(BLUE);<br>setbkcolor(8);<br>circle(320,240,100);<br>rectangle(200,120,440,360);<br><br>char *s[12]={"1","2","3","4","5","6","7","8","9","10","11","12"};<br>settextjustify(0,0);<br>settextstyle(4,0,3);<br>int a=-30;<br>int heng[11];<br>int zhong[11];<br>double hudu;<br>int x,y,i;<br>for(i=11;i>=0;i--){<br>a=a+30;<br>hudu=2*pi*a/360;<br>x=320-120*sin(hudu);<br>heng[i]=x;<br>//printf("x=%d %d %d\n",x,a,hudu);<br>y=240-120*cos(hudu);<br>zhong[i]=y;<br>//printf("y=%d %d %d\n",y,a,hudu);<br>setcolor(RED);<br>outtextxy(x,y,s[i]);<br>}<br><br>drawshizhen(t.ti_hour);<br>drawfenzhen(t.ti_min);<br>drawmiaozhen(t.ti_sec);<br>gotoxy(0,0);<br>setwritemode(1);<br>srand(time(NULL));<br>delay(1000);<br>cleardevice();<br><br>}<br><br><br><br><br>getch();<br>closegraph();<br>}<br><br><br>//shizhen<br>void drawshizhen(int a)<br>{<br>int x,y;<br>setcolor(GREEN);<br>x=320+50*sin(2*pi*a/12);<br>y=240-50*cos(pi*a/120);<br>line(320,240,x,y);<br><br>}//line(320,240,heng[t.ti_hour],zhong[t.ti_hour]);<br><br>//fenzhen<br>void drawfenzhen(int b)<br>{<br>int x,y;<br>setcolor(YELLOW);<br>x=320+80*sin(2*pi*b/60);<br>y=240-80*cos(pi*b/30);<br>line(320,240,x,y);<br><br>}<br><br><br>//miaozhen<br>void drawmiaozhen(int c)<br>{<br>int x,y,z;<br><br><br>setcolor(WHITE);<br>x=320+100*sin(2*pi*c/60);<br>y=240-100*cos(2*pi*c/60);<br>line(320,240,x,y);<br><br>//cleardevice();<br><br><br>}<br><br>页:
[1]
