写了个不错的返回字符串子串在母串中出现次数的...
有兴趣的朋友可以试下
unsigned int CountSubstringTimes(char * subs,char *s){ static unsigned int ls =strlen(subs), l =strlen(s); static unsigned int time =0; if(ls > l) return time; if(s[0]) { if(subs[0]) { if(subs[0]!=s[0]) return CountSubstringTimes(subs,s+1); else { return CountSubstringTimes(subs+1,s+1); } } else { time ++; return CountSubstringTimes(subs-ls,s); } } else { if(!subs[0]) time++; return time; }}cout<<CountSubstringTimes("do","idoidoidodoidoloveyouanddoyoudoyoudodoyoulovemetoo");