时钟代码c语言(时钟代码c语言程序)

时钟代码c语言(时钟代码c语言程序)计算机图形作业 费了很大脑子写出来的 1 时钟 鄙人最得意的一个作品 includegraph h includemath h includedos h define pi 3 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 d X a b c Y a b c Bline 300

计算机图形作业 费了很大脑子写出来的!!!

1、时钟(鄙人最得意的一个作品)

#includegraphics.h

#includemath.h

#includedos.h

#define pi 3.

#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,d) X(a,b,c);Y(a,b,c);Bline(300,240,x,y,d)

void plot_circle_points(int xc, int yc, int x, int y, int c)

{

putpixel(xc+x, yc+y, c);

putpixel(xc-x, yc+y, c);

putpixel(xc+x, yc-y, c);

putpixel(xc-x, yc-y, c);

putpixel(xc+y, yc+x, c);

putpixel(xc-y, yc+x, c);

putpixel(xc+y, yc-x, c);

putpixel(xc-y, yc-x, c);

}

void Bcircle (int xc, int yc, int radius, int c)

{

int x, y, p;

x=0;

y=radius;

p=3-2*radius;

while (xy){

plot_circle_points(xc, yc, x, y, c);

if (p0) p=p+4*x+6;

else{

p=p+4*(x-y)+10;

y-=1;

}

x+=1;

}

if (x == y)

plot_circle_points(xc, yc, x, y, c);

}

void Bline (int x1, int y1, int x2, int y2, int c)

{

int x, y, tmp;

int dx, dy, d;

float k;

if( 0 == (x1 - x2))

{

x = x1;

if(y1 y2)

{ tmp = y1;y1 = y2; y2 =tmp;}

for(y = y1; y y2; y ++)

{

putpixel(x, y, abs(getpixel(x,y)-c));

}

return;

}

k = (float)(y2 -y1)/(float)(x2 - x1);

if(k 1.0)

{

tmp = x1; x1 = y1; y1 = tmp;

tmp = x2; x2 = y2; y2 = tmp;

}

else if(k 0)

{}

else if(k -1.0)

{

x1 = -x1;

x2 = -x2;

tmp = x1; x1 = y1; y1 = tmp;

tmp = x2; x2 = y2; y2 = tmp;

}

else if( k 0)

{

y1 = - y1;

y2 = - y2;

}

else

{

y = y1;

if(x1 x2)

{ tmp = x1; x1 = x2; x2 = tmp;}

for(x = x1; x = x2; x ++)

{

putpixel(x, y, abs(getpixel(x,y)-c));

}

return;

}

if(x1 x2)

{

tmp = x1; x1 = x2; x2 = tmp;

tmp = y1; y1 = y2; y2 = tmp;

}

dx =

今天的文章 时钟代码c语言(时钟代码c语言程序)分享到此就结束了,感谢您的阅读。
编程小号
上一篇 2025-08-15 09:11
下一篇 2025-07-23 14:40

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/bian-cheng-ri-ji/31797.html