Advertisement
MeehoweCK

Untitled

Jul 17th, 2019
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. bool czy_jest(string napis1, string szukany)
  6. {
  7.     bool flaga;
  8.     for(unsigned i = 0; i <= napis1.size() - szukany.size(); ++i)
  9.     {
  10.         flaga = true;
  11.         for(unsigned j = 0; j < szukany.size(); ++j)
  12.         {
  13.             if(napis1[i + j] == szukany[j])
  14.                 continue;
  15.             flaga = false;
  16.             break;
  17.         }
  18.         if(flaga)
  19.             return true;
  20.     }
  21.     return false;
  22. }
  23.  
  24. int main()
  25. {
  26.     string napis1, napis2;
  27.     getline(cin, napis1);
  28.     cin >> napis2;
  29.  
  30.     cout << czy_jest(napis1, napis2) << endl;
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement