Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int wordsearch (char **mas, int q)
- {
- cout<<"Введите слово для поиска"<<endl;
- char word[b];
- cin.getline(word,b);
- int n=0,l=0,wl=0,buf=0;
- long int d=0,p=0;
- p=strlen(word);
- for (int i=0;i<q;i++)
- {
- d=strlen(mas[i]);
- for (int j=0;j<d;)
- {
- if (!spaces(mas[i][j])&&!puncts(mas[i][j]))
- {
- buf=j;
- while (!spaces(mas[i][j])&&!puncts(mas[i][j]))
- {
- wl++;
- j++;
- }
- j=buf;
- for (int z=0;z<b;z++)
- if (p==wl&&word[z]==mas[i][j])
- {
- l++;
- j++;
- }
- if (l==p) n++;
- l=0;
- }
- else j++;
- cout<<n<<endl;
- n=0;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment