Комментарии:
you are so dashing and handsome
ОтветитьCan this be done with a dynamic array and user-entered strings? Im a c++ student just started recently Edit: Professor wants us to use c-string
Ответитьanother way to count the occurences of your substring is this:
although it uses another temporary char array.
char str[]="the cat chased the mouse"
char sub[] = "the"
char temp[strlen(sub)];
strcpy(temp, str);
int occurence=0;
while( strstr(temp, sub) != NULL)
{
occurence++;
strcpy( temp, strstr(temp, sub) + strlen(sub) );
}
//char original string (str) is being copied to temp array, then the temp array is being checked if it contains the substring, if it does it increments occurence and then overwrites the temp array EXCLUDING the found substring and repeats.
AMAZING Walk through
Ответитьnice explanation keep code for as
ОтветитьExcellent explanation 👌👌
ОтветитьCongrats bro for 1k subs!!🤟
Ответить