#include<string.h>
#include<stdio.h>
int fun(char *s1
,char *s2
)
{
int i
,j
,n
=0;
for(i
=0;i
<=strlen(s1
)-strlen(s2
);i
++){
for(j
=0;j
<strlen(s2
);j
++)
if(s1
[i
+j
]!=s2
[j
]) break;
if(j
==strlen(s2
))
n
++;
}
return n
;
}
int main()
{ char a
[80],b
[80];
int n
;
printf("Please input the first string:");
gets(a
);
printf("Please input the second string:");
gets(b
);
n
=fun(a
,b
);
if(n
==0)
printf("No find\n");
else printf("n=%d\n",n
);
}
转载请注明原文地址: https://lol.8miu.com/read-1660.html