“`”

【参考答案】

<pre><code class=""language-c"" lang=""c"">main()
{
char str1[20],str2[20],*p1,*p2;
int sum=0;
printf(""please input two strings\n"");
scanf(""%s%s"",str1,str2);
p1=str1;p2=str2;
while(*p1!='\0')
{
if(*p1==*p2)
{
while(*p1==*p2&&*p2!='\0')
{
p1++;
p2++;
}
}
else
p1++;
if(*p2=='\0')
sum++;
p2=str2;
}
printf(""%d"",sum);
getch();
}
</code></pre>

<pre><code> "“`

Was this helpful?

0 / 0

发表回复 0

Your email address will not be published.