题目题目:计算字符串中子串出现的次数。相关知识点: 试题来源: 解析 答案: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!
题目:计算字符串中子串出现的次数 提示:请使用scanf 函数输入2个字符串str1, str2 ,再计算字符串中子串出现的次数 */ int main() { char str1[100]; char str2[50]; int m_count = 0; scanf("%s", str1); scanf("%s", str2); char* tmp = str1; while ((tmp = strstr(tmp, str2))...