<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="https://www.gentoo-zh.org/extern.php?action=feed&amp;tid=405&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Gentoo中文社区 / C 练习实例96]]></title>
		<link>https://www.gentoo-zh.org/viewtopic.php?id=405</link>
		<description><![CDATA[C 练习实例96 最近发表的帖子。]]></description>
		<lastBuildDate>Mon, 29 Aug 2022 11:56:27 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[C 练习实例96]]></title>
			<link>https://www.gentoo-zh.org/viewtopic.php?pid=411#p411</link>
			<description><![CDATA[<p>题目：计算字符串中子串出现的次数 。</p><p>程序分析：无。</p><div class="codebox"><pre><code>#include&lt;stdio.h&gt;
#include&lt;stdlib.h&gt;
#include&lt;string.h&gt;
int main()
{
    int i,j,k,TLen,PLen,count=0;
    char T[50],P[10];
    printf(&quot;请输入两个字符串，以回车隔开，母串在前，子串在后：\n&quot;);
    gets(T);
    gets(P);
    TLen=strlen(T);
    PLen=strlen(P);
    for(i=0;i&lt;=TLen-PLen;i++)
    {
        for(j=0,k=i;j&lt;PLen&amp;&amp;P[j]==T[k];j++,k++)
            ;
        if(j==PLen)count++;
    }
    printf(&quot;%d\n&quot;,count);
    system(&quot;pause&quot;);
    return 0;
}</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (batsom)]]></author>
			<pubDate>Mon, 29 Aug 2022 11:56:27 +0000</pubDate>
			<guid>https://www.gentoo-zh.org/viewtopic.php?pid=411#p411</guid>
		</item>
	</channel>
</rss>
