Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int i,j;
- char x[50]={"blackcats"};
- char y[30]={"cat"};
- bool b=false;
- bool q;
- int k=strlen(x);
- int t=strlen(y);
- for (i=0;i<k&&!b;i++)
- {
- q=true;
- int p=i;
- for (j=0;j<t&&q&&p<k;j++,p++)
- if (x[p]!=y[j])
- q=false;
- if (q&&j==t)
- b=true;
- }
- if(b) cout<<"true"<<endl;
- else cout<<"false";
- system ("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment