Aleksandr_Grigoryev

строки 52

Feb 16th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int i,j;
  6.     char x[50]={"blackcats"};
  7.     char y[30]={"cat"};
  8.     bool b=false;
  9.     bool q;
  10.     int k=strlen(x);
  11.     int t=strlen(y);
  12.     for (i=0;i<k&&!b;i++)
  13.     {
  14.         q=true;
  15.     int p=i;
  16.     for (j=0;j<t&&q&&p<k;j++,p++)
  17.         if (x[p]!=y[j])
  18.             q=false;
  19.     if (q&&j==t)
  20.         b=true;
  21.     }
  22.     if(b) cout<<"true"<<endl;
  23.     else cout<<"false";
  24.  
  25. system ("pause");
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment