<?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=369&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Gentoo-zh / C 练习实例60]]></title>
		<link>http://www.gentoo-zh.org/viewtopic.php?id=369</link>
		<description><![CDATA[C 练习实例60 最近发表的帖子。]]></description>
		<lastBuildDate>Mon, 29 Aug 2022 11:35:41 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[C 练习实例60]]></title>
			<link>http://www.gentoo-zh.org/viewtopic.php?pid=375#p375</link>
			<description><![CDATA[<p>题目：画图，综合例子2。（在TC中实现）。</p><p>程序分析：无。</p><p>程序源代码：</p><div class="codebox"><pre class="vscroll"><code>#include &quot;graphics.h&quot;
#define LEFT 0
#define TOP 0
#define RIGHT 639
#define BOTTOM 479
#define LINES 400
#define MAXCOLOR 15
int main()
{
    int driver,mode,error;
    int x1,y1;
    int x2,y2;
    int dx1,dy1,dx2,dy2,i=1;
    int count=0;
    int color=0;
    driver=VGA;
    mode=VGAHI;
    initgraph(&amp;driver,&amp;mode,&quot;&quot;);
    x1=x2=y1=y2=10;
    dx1=dy1=2;
    dx2=dy2=3;
    while(!kbhit())
    {
        line(x1,y1,x2,y2);
        x1+=dx1;y1+=dy1;
        x2+=dx2;y2+dy2;
        if(x1&lt;=LEFT||x1&gt;=RIGHT)
            dx1=-dx1;
        if(y1&lt;=TOP||y1&gt;=BOTTOM)
            dy1=-dy1;
        if(x2&lt;=LEFT||x2&gt;=RIGHT)
            dx2=-dx2;
        if(y2&lt;=TOP||y2&gt;=BOTTOM)
                dy2=-dy2;
        if(++count&gt;LINES)
        {
            setcolor(color);
            color=(color&gt;=MAXCOLOR)?0:++color;
        }
    }
    closegraph();
}</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (batsom)]]></author>
			<pubDate>Mon, 29 Aug 2022 11:35:41 +0000</pubDate>
			<guid>http://www.gentoo-zh.org/viewtopic.php?pid=375#p375</guid>
		</item>
	</channel>
</rss>
