时钟程序---帮忙注释一下啊
#include<graphics.h> #include<math.h>
#include<dos.h>
#define PI 3.1415926
#define mid_x 320
#define mid_y 240
int main()
{ int graphdriver=DETECT,graphmode;
int end_x,end_y;
struct time curtime;
float th_hour,th_min,th_sec;
initgraph(&graphdriver,&graphmode,"C:\\TC2");
setbkcolor(BLACK);
while(!kbhit(0))
{ setcolor(GREEN);
circle(mid_x,mid_y,180);
circle(mid_x,mid_y,150);
circle(mid_x,mid_y,1);
gettime(&curtime);
th_sec=(float)curtime.ti_sec*0.1047197551;
th_min=(float)curtime.ti_min*0.1047197551+th_sec/60.0;
th_hour=(float)curtime.ti_hour*0.5235987755+th_min/12.0;
end_x=mid_x+70*sin(th_hour);
end_y=mid_y-70*cos(th_hour);
setcolor(RED);
line(mid_x,mid_y,end_x,end_y);
end_x=mid_x+110*sin(th_min);
end_y=mid_y-110*cos(th_min);
setcolor(RED);
line(mid_x,mid_y,end_x,end_y);
end_x=mid_x+140*sin(th_sec);
end_y=mid_y-140*cos(th_sec);
setcolor(RED);
line(mid_x,mid_y,end_x,end_y);
line(140,240,160,240);
line(320,60,320,80);
line(500,240,480,240);
line(320,420,320,400);
line(410,395.7,400,378.4);
line(475.7,330,458.4,320);
line(475.7,150,458.4,160);
line(410,84.3,400,101.6);
line(230,84.3,240,101.6);
line(164.3,150,181.6,160);
line(164.3,330,181.6,320);
line(230,395.7,240,378.4);
sleep(BLUE);
cleardevice();
}
closegraph();
return 0;
}
我是新手
不太懂啊
哪位高手给我注释以下啊
----------------解决方案--------------------------------------------------------
既然可以写出来
怎么会看不懂呢???
奇怪ing~~~~~~~~
----------------解决方案--------------------------------------------------------
不是我写的啊
我想学学
能注释一下吗???谢谢啊
----------------解决方案--------------------------------------------------------
我也不会````LZ``可以问问这个程序的作者``
首先``我问你``单独看每条语句``你懂不``
不懂``你就要看了``
我还想知道怎么写WINDOWS呢``
----------------解决方案--------------------------------------------------------
看了这才发现我的图形学算是白学习了,
----------------解决方案--------------------------------------------------------
OpenGL才是图形学的王道,何必叹息
----------------解决方案--------------------------------------------------------
不错的东东.
----------------解决方案--------------------------------------------------------
#include<graphics.h>
#include<math.h>
#include<dos.h>
#define PI 3.1415926
#define mid_x 320
#define mid_y 240
int main()
{ int graphdriver=DETECT,graphmode;
int end_x,end_y;
struct time curtime; //////////////////////////////////////what's this? C里有这个结构吗?其他的好象都还行,基本就是图形学的东西
float th_hour,th_min,th_sec;
initgraph(&graphdriver,&graphmode,"C:\\TC2");
setbkcolor(BLACK);
while(!kbhit(0))
{ setcolor(GREEN);
circle(mid_x,mid_y,180);
circle(mid_x,mid_y,150);
circle(mid_x,mid_y,1);
gettime(&curtime);
th_sec=(float)curtime.ti_sec*0.1047197551;
th_min=(float)curtime.ti_min*0.1047197551+th_sec/60.0;
th_hour=(float)curtime.ti_hour*0.5235987755+th_min/12.0;
end_x=mid_x+70*sin(th_hour);
end_y=mid_y-70*cos(th_hour);
setcolor(RED);
line(mid_x,mid_y,end_x,end_y);
end_x=mid_x+110*sin(th_min);
end_y=mid_y-110*cos(th_min);
setcolor(RED);
line(mid_x,mid_y,end_x,end_y);
end_x=mid_x+140*sin(th_sec);
end_y=mid_y-140*cos(th_sec);
setcolor(RED);
line(mid_x,mid_y,end_x,end_y);
line(140,240,160,240);
line(320,60,320,80);
line(500,240,480,240);
line(320,420,320,400);
line(410,395.7,400,378.4);
line(475.7,330,458.4,320);
line(475.7,150,458.4,160);
line(410,84.3,400,101.6);
line(230,84.3,240,101.6);
line(164.3,150,181.6,160);
line(164.3,330,181.6,320);
line(230,395.7,240,378.4);
sleep(BLUE);
cleardevice();
}
closegraph();
return 0;
}
----------------解决方案--------------------------------------------------------