标签:str c++ strstr article 有一个 count rac 查找 print
#include<stdio.h> #include <string.h> int strstrcount( char *str1, char *str2 ) { char *str = str1; int c = 0; while( (str = strstr( str, str2 )) != NULL ) { c++; str++; } return c; } int main() { char str1[20]; char str2[20]; gets(str1); gets(str2); printf("%d\n",strstrcount(str1,str2)); return 0; }
标签:str c++ strstr article 有一个 count rac 查找 print
原文地址:http://www.cnblogs.com/lytwajue/p/7397480.html