| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 652 人关注过本帖
标题:[求助]编好的程序无法动
只看楼主 加入收藏
princeofdrea
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2007-5-11
收藏
 问题点数:0 回复次数:1 
[求助]编好的程序无法动
用TC载个贪食蛇的源码编译分析
编译好后运行,在cmd和command中也运行了
蛇不动,其他的程序,如时钟也无法动
我在其他机中试是会动的
请问什么原因?

还有一个问题:怎么使图形动啊?

PS:本人超级菜鸟

[此贴子已经被作者于2007-5-12 1:17:47编辑过]

搜索更多相关主题的帖子: 其他 时钟 command 贪食蛇 
2007-05-12 01:12
princeofdrea
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2007-5-11
收藏
得分:0 
钟的代码:
#include<graphics.h>
#include<math.h>
#include<dos.h>
#define pi 3.1415926
#define X(a,b,c) x=a*cos((b*c)*pi/180-pi/2)+300;
#define Y(a,b,c) y=a*sin((b*c)*pi/180-pi/2)+240;
#define d(a,b,c) X(a,b,c);Y(a,b,c);line(300,240,x,y)
void init()
{int i,l,x1,x2,y1,y2;
setbkcolor(0);
setcolor(2);
circle(300,240,194);
setcolor(3);
circle(300,240,201);
setcolor(5);
circle(300,240,205);
setcolor(6);
circle(300,240,5);
setcolor(7);
circle(300,240,3);
setcolor(2);
settextstyle(1,0,4);
outtextxy(287,55,"12");
outtextxy(293,390,"6");
outtextxy(122,223,"9");
outtextxy(465,223,"3");
setcolor(12);
for(i=0;i<60;i++)
{if(i%5==0){setcolor(4);setlinestyle(0,0,3); l=6;}
else {setcolor(7);setlinestyle(0,0,1);l=6;}
x1=200*cos(i*6*pi/180)+300;
y1=200*sin(i*6*pi/180)+240;
x2=(200-l)*cos(i*6*pi/180)+300;
y2=(200-l)*sin(i*6*pi/180)+240;
line(x1,y1,x2,y2);
}
}
main()
{
int x,y;
int gd=VGA,gm=2;
unsigned char h,m,s;
struct time t[1];
initgraph(&gd,&gm,"d:\\learn\\tce");
init();
setwritemode(1);
gettime(t);
h=t[0].ti_hour;
m=t[0].ti_min;
s=t[0].ti_sec;
setcolor(7);
d(150,(h*30+m*0.5),1);
setcolor(14);
d(170,m,6);
setcolor(4);
d(190,s,6);
while(!kbhit())
{while(t[0].ti_sec==s)
gettime(t);
sound(400);
delay(70);
sound(200);
delay(30);
nosound();
setcolor(4);
d(190,s,6);
s=t[0].ti_sec;
d(190,s,6);
if (t[0].ti_min!=m)
{
setcolor(14);
d(170,m,6);
m=t[0].ti_min;
d(170,m,6);
}
if (t[0].ti_hour!=h)
{ setcolor(7);
if(m!=60)d(150,(h*30+m*0.5),1);
d(150,(h*30),1);
h=t[0].ti_hour;
if(m!=60) d(150,(h*30+m*0.5),1);
d(150,(h*30),1);
sound(1000);
delay(240);
nosound();
delay(140);
sound(2000);
delay(240);
nosound();
}
}
getch();
closegraph();
}

2007-05-12 14:11
快速回复:[求助]编好的程序无法动
数据加载中...
 
   



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

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