Advertisement
MeehoweCK

Untitled

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