Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int x=0;
  8. char a[100],b[10], *p;
  9. cout<<"a: "; cin>>a;
  10. cout<<"b: "; cin>>b;
  11. if(strstr(a,b)!=0)
  12. cout<<"Apare ";
  13. else
  14. cout<<"Nu apare!";
  15.  
  16. cout<<endl;
  17. p=strstr(a,b);
  18. while(p!=0)
  19. {
  20. x++;
  21. p=strstr(p+strlen(b),b);
  22. }
  23. cout<<"Apare de "<<x<<" ori!"<<endl;
  24.  
  25. system("pause");
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement