Guest User

Untitled

a guest
Oct 22nd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void findtext(string input, string wzor){
  6. int inputDl = input.size();
  7. int wzorDl = wzor.size();
  8. bool ok = true;
  9.  
  10. for(int i=0; i<inputDl; i++){
  11. ok = true;
  12. for(int j=0; j<wzorDl; j++){
  13. // cout<<i<<" "<<j<<" [] " <<ok<<endl;
  14. // cout<<input[j+i]<<endl;
  15. // cout<<wzor[j]<<endl;
  16. if(input[j+i]!=wzor[j]){
  17. ok = false;
  18. break;
  19. }
  20. }
  21.  
  22. if(ok){
  23. cout<<"ZNALEZIONO WZORZEC NA POZYCJI: "<<i<<endl;
  24. break;
  25. }
  26. }
  27.  
  28. if(!ok){
  29. cout<<"NIE ZNALEZIONO WZORCA"<<endl;
  30. }
  31.  
  32. }
  33.  
  34. int main()
  35. {
  36. string input = "karykatura";
  37. string wzor = "ryk";
  38. findtext(input, wzor);
  39.  
  40. return 0;
  41. }
Add Comment
Please, Sign In to add comment