What should this function return? And how can you determine in which of the sentences the key word occurs more often?
I wrote the program, but how to do everything in the function?
Write a function that determines whether the user-specified keyword is part of the given character string. On the basis of the developed function, determine which of the sentences contains the specified key set of characters more often.
int main() { char cszSentences[5][100] = {0 }; for (int i=0, i<5.i++) { gets(cszSentences[i]) } char szKeyword[10]; printf("Choose a keyword\n"); gets(szKeyword); int iLen = strlen(szKeyword); int n = 0; for (int i = 0; i < 5; i++) { for(const char *src = cszSentences[i]; (src = strstr(src, szKeyword)) != 0; src += iLen) { n++; } printf("in %d sentence is %d keywords\n", i+1, n); n = 0; } }
На основе разработанной функции определить, в каком из предложений больше раз встречается заданное ключевой набор символов.- along with countingnin the same cycle, look for the maximum of them and memorize the correspondingi. After the cycle, the problem is solved. - avp