| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 810 人关注过本帖
标题:[求助]为什么我这个程序运行时每隔几秒屏幕会花啊?该改什么地方啊?
只看楼主 加入收藏
pierse1028
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2007-4-7
收藏
 问题点数:0 回复次数:0 
[求助]为什么我这个程序运行时每隔几秒屏幕会花啊?该改什么地方啊?
# include <stdio.h>
# include <stdlib.h>
# include <conio.h>
# include<graphics.h>
# include<dos.h>
# include<math.h>
# include<complex.h>
# define pi 3.1415
void drawshizhen(int a) ;
void drawfenzhen(int b) ;
void drawmiaozhen(int c) ;


void main()
{
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"d:\\tc\\BGI");
//cleardevice();


while(!kbhit()){
setwritemode(1);
srand(time(NULL));

int j;
struct time t;
gettime(&t);
printf("The current time is: %2d:%02d:%02d.%02d\n",t.ti_hour, t.ti_min, t.ti_sec, t.ti_hund);
gotoxy(0,0);


setcolor(BLUE);
setbkcolor(8);
circle(320,240,100);
rectangle(200,120,440,360);

char *s[12]={"1","2","3","4","5","6","7","8","9","10","11","12"};
settextjustify(0,0);
settextstyle(4,0,3);
int a=-30;
int heng[11];
int zhong[11];
double hudu;
int x,y,i;
for(i=11;i>=0;i--){
a=a+30;
hudu=2*pi*a/360;
x=320-120*sin(hudu);
heng[i]=x;
//printf("x=%d %d %d\n",x,a,hudu);
y=240-120*cos(hudu);
zhong[i]=y;
//printf("y=%d %d %d\n",y,a,hudu);
setcolor(RED);
outtextxy(x,y,s[i]);
}

drawshizhen(t.ti_hour);
drawfenzhen(t.ti_min);
drawmiaozhen(t.ti_sec);
gotoxy(0,0);
setwritemode(1);
srand(time(NULL));
delay(1000);
cleardevice();

}




getch();
closegraph();
}


//shizhen
void drawshizhen(int a)
{
int x,y;
setcolor(GREEN);
x=320+50*sin(2*pi*a/12);
y=240-50*cos(pi*a/120);
line(320,240,x,y);

}//line(320,240,heng[t.ti_hour],zhong[t.ti_hour]);

//fenzhen
void drawfenzhen(int b)
{
int x,y;
setcolor(YELLOW);
x=320+80*sin(2*pi*b/60);
y=240-80*cos(pi*b/30);
line(320,240,x,y);

}


//miaozhen
void drawmiaozhen(int c)
{
int x,y,z;


setcolor(WHITE);
x=320+100*sin(2*pi*c/60);
y=240-100*cos(2*pi*c/60);
line(320,240,x,y);

//cleardevice();


}

搜索更多相关主题的帖子: 屏幕 运行 
2007-08-20 21:33
快速回复:[求助]为什么我这个程序运行时每隔几秒屏幕会花啊?该改什么地方啊?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.024039 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved