Original Post
Hi, i have to write that functio that takes astring (string1) as parameter. the function should ask the user to enter astring(string2)and then count and print the number of times that (string2) occurs in (string1). the function should count lower and upper cases??? .use strstr to slove this problem. this was my answer: void display_substring_frequency(char*str) { cout<<"enter astring"<<endl; int c=0; while(cin.get()!='\n') continue; char arr[20]; cin.getline(arr,20); while(*str!=NULL){ strstr(str,arr); c++; *str++;}// i just need away to let the strstr start searching from the last occurs of arr cout<<"the string\t"<<arr<<"\tis repeated\t"<<c<<"\ttimes"<<endl; }