Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- using namespace std;
- int main()
- {
- int x=0;
- char a[100],b[10], *p;
- cout<<"a: "; cin>>a;
- cout<<"b: "; cin>>b;
- if(strstr(a,b)!=0)
- cout<<"Apare ";
- else
- cout<<"Nu apare!";
- cout<<endl;
- p=strstr(a,b);
- while(p!=0)
- {
- x++;
- p=strstr(p+strlen(b),b);
- }
- cout<<"Apare de "<<x<<" ori!"<<endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement