golfflower

asdkl

Feb 18th, 2020
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1.  
  2. int wordsearch (char **mas, int q)
  3. {
  4. cout<<"Введите слово для поиска"<<endl;
  5. char word[b];
  6. cin.getline(word,b);
  7. int n=0,l=0,wl=0,buf=0;
  8. long int d=0,p=0;
  9. p=strlen(word);
  10. for (int i=0;i<q;i++)
  11. {
  12. d=strlen(mas[i]);
  13. for (int j=0;j<d;)
  14. {
  15. if (!spaces(mas[i][j])&&!puncts(mas[i][j]))
  16. {
  17. buf=j;
  18. while (!spaces(mas[i][j])&&!puncts(mas[i][j]))
  19. {
  20. wl++;
  21. j++;
  22. }
  23. j=buf;
  24.  
  25. for (int z=0;z<b;z++)
  26. if (p==wl&&word[z]==mas[i][j])
  27. {
  28. l++;
  29. j++;
  30.  
  31. }
  32. if (l==p) n++;
  33. l=0;
  34. }
  35. else j++;
  36. cout<<n<<endl;
  37. n=0;
  38. }
  39. }
  40.  
  41. return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment