<?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=363&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Gentoo-zh / C 练习实例 54]]></title>
		<link>http://www.gentoo-zh.org/viewtopic.php?id=363</link>
		<description><![CDATA[C 练习实例 54 最近发表的帖子。]]></description>
		<lastBuildDate>Mon, 29 Aug 2022 11:31:00 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[C 练习实例 54]]></title>
			<link>http://www.gentoo-zh.org/viewtopic.php?pid=369#p369</link>
			<description><![CDATA[<p>题目：取一个整数 a 从右端开始的 4～7 位。</p><p>程序分析：可以这样考虑：</p><p>(1)先使 a 右移 4 位。</p><p>(2)设置一个低 4 位全为 1，其余全为 0 的数，可用~(~0&lt;&lt;4)</p><p>(3)将上面二者进行 &amp; 运算。</p><div class="codebox"><pre><code>#include &lt;stdio.h&gt;
int main()
{
    unsigned a,b,c,d;
    printf(&quot;请输入整数：\n&quot;);
    scanf(&quot;%o&quot;,&amp;a);
    b=a&gt;&gt;4;
    c=~(~0&lt;&lt;4);
    d=b&amp;c;
    printf(&quot;%o\n%o\n&quot;,a,d);
    return 0;
}</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (batsom)]]></author>
			<pubDate>Mon, 29 Aug 2022 11:31:00 +0000</pubDate>
			<guid>http://www.gentoo-zh.org/viewtopic.php?pid=369#p369</guid>
		</item>
	</channel>
</rss>
