<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="http://gentoo-zh.org/extern.php?action=feed&amp;tid=374&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Gentoo-zh / C 练习实例65]]></title>
		<link>http://www.gentoo-zh.org/viewtopic.php?id=374</link>
		<description><![CDATA[C 练习实例65 最近发表的帖子。]]></description>
		<lastBuildDate>Mon, 29 Aug 2022 11:38:53 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[C 练习实例65]]></title>
			<link>http://www.gentoo-zh.org/viewtopic.php?pid=380#p380</link>
			<description><![CDATA[<p>题目：一个最优美的图案（在TC中实现）。</p><p>程序分析：无。</p><p>程序源代码：</p><div class="codebox"><pre class="vscroll"><code>#include &quot;graphics.h&quot;
#include &quot;math.h&quot;
#include &quot;dos.h&quot;
#include &quot;conio.h&quot;
#include &quot;stdlib.h&quot;
#include &quot;stdio.h&quot;
#include &quot;stdarg.h&quot;
#define MAXPTS 15
#define PI 3.1415926
struct PTS {
    int x,y;
};
double AspectRatio=0.85;
void LineToDemo(void)
{
    struct viewporttype vp;
    struct PTS points[MAXPTS];
    int i, j, h, w, xcenter, ycenter;
    int radius, angle, step;
    double rads;
    printf(&quot; MoveTo / LineTo Demonstration&quot; );
    getviewsettings( &amp;vp );
    h = vp.bottom - vp.top;
    w = vp.right - vp.left;
    xcenter = w / 2; /* Determine the center of circle */
    ycenter = h / 2;
    radius = (h - 30) / (AspectRatio * 2);
    step = 360 / MAXPTS; /* Determine # of increments */
    angle = 0; /* Begin at zero degrees */
    for( i=0 ; i&lt;MAXPTS ; ++i ){ /* Determine circle intercepts */
        rads = (double)angle * PI / 180.0; /* Convert angle to radians */
        points[i].x = xcenter + (int)( cos(rads) * radius );
        points[i].y = ycenter - (int)( sin(rads) * radius * AspectRatio );
        angle += step; /* Move to next increment */
    }
    circle( xcenter, ycenter, radius ); /* Draw bounding circle */
    for( i=0 ; i&lt;MAXPTS ; ++i ){ /* Draw the cords to the circle */
        for( j=i ; j&lt;MAXPTS ; ++j ){ /* For each remaining intersect */
            moveto(points[i].x, points[i].y); /* Move to beginning of cord */
            lineto(points[j].x, points[j].y); /* Draw the cord */
        }
    }
}
int main()
{
    int driver,mode;
    driver=CGA;mode=CGAC0;
    initgraph(&amp;driver,&amp;mode,&quot;&quot;);
    setcolor(3);
    setbkcolor(GREEN);
    LineToDemo();
}</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (batsom)]]></author>
			<pubDate>Mon, 29 Aug 2022 11:38:53 +0000</pubDate>
			<guid>http://www.gentoo-zh.org/viewtopic.php?pid=380#p380</guid>
		</item>
	</channel>
</rss>
